#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
class P{
public:
LL x,y;
P(LL xx = 0,LL yy = 0):x(xx),y(yy){}
};
bool operator < (const P &a,const P &b){
return a.x < b.x;
}
P operator +(const P &a,const P &b){
P p = a;
p.x += b.x;
p.y += b.y;
return p;
}
P operator -(const P a,const P &b){
P p = a;
p.x -= b.y;
p.y -= b.x;
return p;
}
P operator *(const P &a,const P &b){
P p;
p.x = min(a.x*b.x,min(a.x*b.y,min(a.y*b.x,a.y*b.y)));
p.y = max(a.x*b.x,max(a.x*b.y,max(a.y*b.x,a.y*b.y)));
return p;
}
P expression_value();
P term_value();
P factor_value();
P prefactor_value();
const LL maxn = 200;
char ar[maxn];
LL cnt = 0;
LL n;
int main(){
while(scanf("%s",ar)!=EOF){
n = strlen(ar);
cnt = 0;
P ans = expression_value();
printf("%lld %lld\n",ans.x,ans.y);
memset(ar,0,sizeof(ar));
}
return 0;
}
P expression_value(){
P result = term_value();
bool more = true;
while( more ){
char op = ar[cnt];
if( op == '+' || op == '-'){
cnt++;
P value = term_value();
if( op == '+' ) result =result+ value;
else result = result - value;
}
else more = false;
}
return result;
}
P term_value(){
P result = prefactor_value();
while(true){
char op = ar[cnt];
if( op == '*' || op == '/' ){
cnt++;
P value = prefactor_value();
result = result* value;
}
else break;
}
return result;
}
P prefactor_value(){
P result = factor_value();
while(true){
char op = ar[cnt];
if( op == 'd' ){
cnt++;
P value = factor_value();
value.x = 1;
result = result * value;
}
else break;
}
return result;
}
P factor_value(){
P result;
char c = ar[cnt];
if( c == '(' ){
cnt++;
result = expression_value();
cnt++;
}
else{
bool t = false;
if(c == '-'){
t = true;
cnt++;
c = ar[cnt];
}
LL res = 0;
while( isdigit(c) ){
res = res*10 + c - '0';
cnt++;
c = ar[cnt];
}
if(t)
res = -res;
result.x = res;
result.y = res;
}
return result;
}