#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define mp make_pair #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector vb; typedef vector vi; typedef vector vvb; typedef vector vvi; typedef pair pii; const int INF=1<<29; const double EPS=1e-9; const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1}; int main() { string s; cin >> s; string ss; int ans; int nowop; int start; if (s[0] == '-') { ans = s[1] - '0'; ans = -ans; nowop = -1; start = 2; } else { ans = s[0] - '0'; nowop = 1; start = 1; } for (int i = start; i < s.size(); i++) { if (s[i] == '(') { i++; int num1 = 0; while(isdigit(s[i])) { num1 *= 10; num1 += s[i] - '0'; i++; } while(1) { if (s[i] == ')') break; int op = s[i] == '+' ? 1 : -1; i++; int num2 = 0; while(isdigit(s[i])) { num2 *= 10; num2 += s[i] - '0'; i++; } num1 = num1 + op * num2; } ans += nowop * num1; } else { if (s[i] == '+') nowop = 1; else if (s[i] == '-') nowop = -1; else { ans += nowop * (s[i] - '0'); } } } cout << ans << endl; return 0; }