#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; string s; int i = 0; int f(); int g() { if(isdigit(s[i])) { int res = s[i] - '0'; i++; return res; } if(s[i] == '(') { i++; int res = f(); i++; return res; } } int f() { int res = g(); while(true) { if(s[i] == '+') { i++; res += g(); } else if(s[i] == '-') { i++; res -= g(); } else { return res; } } } int main(){ cin.tie(0); ios::sync_with_stdio(0); cin >> s; cout << f() << endl; }