#include using namespace std; int operate() { int a = 0, b; char c,op; while(1) { cin >> c; if(cin.eof()) { return a; } if( c == ')' ) { break; } else if( c == '(' ) { b = a; a = operate(); } else if(c != '+' && c != '-' && c != '*') { b = a; a = c - 48; } else { op = c; } } switch(op) { case '+': return b+a; break; case '-': return b-a; break; case '*': return b*a; break; } } int main() { cout << operate() << endl; return 0; }