#include <bits/stdc++.h>
// #define mem(ar,num) memset(ar,num,sizeof(ar))
// #define me(ar) memset(ar,0,sizeof(ar))
// #define lowbit(x) (x&(-x))
// #define Pb push_back
// // #define FI first
// // #define SE second
// #define rep(i,a,n) for (int i=a;i<n;i++)
// #define per(i,a,n) for (int i=n-1;i>=a;i--)
// #define IOS ios::sync_with_stdio(false)
// #define DEBUG cout<<endl<<"DEBUG"<<endl; 
using namespace std;
typedef long long LL;
// LL Min(LL x,LL y,LL z,LL w){

// }
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 == '-'){
// cin.get(); //从输入中取走一个字符
            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 == '/' ){
// cin.get();
            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'  ){
// cin.get();
            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 == '(' ){                         //括号'('包裹,当中是一个表达式
// cin.get();
        cnt++;
        result = expression_value();
// cin.get();
        cnt++;
    }
    else{
        bool t = false;       
        if(c == '-'){
             t = true;
             cnt++;
             c = ar[cnt];
        }
        LL res = 0;                    //是一个数字,求出该数
        while( isdigit(c) ){
            res = res*10 + c - '0';
// cin.get();
            cnt++;
            c = ar[cnt];
        }
        if(t)
              res = -res;
        result.x = res;
        result.y = res;
    }
    return result;
}