#include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0;i<(n);++i) #define REPS(i,s,t) for(int i=(s);i<(t);++i) #define INF 2000000007 #define MOD 1000000007 #define MAX 200005 typedef unsigned int uint; typedef unsigned long long int ull; typedef long long int ll; //ull dp[MAX]; string N; int exp(int *n){ int ans = 0; while(N[++*n] != ')'){ if(N[*n] == '+'){ ans += N[++*n]-'0'; } else if(N[*n] == '-'){ ans -= N[++*n]-'0'; } else ans += N[*n]-'0'; } return ans; } int main(){ cin>>N; int ans = 0; int t; REP(i,N.size()){ if(N[i] == '('){ t = exp(&i); } else if(N[i] == '+') if(N[++i] == '(') ans += exp(&i); else ans += N[i]-'0'; else if(N[i] == '-') if(N[++i] == '(') ans -= exp(&i); else ans -= N[i]-'0'; else{ ans += N[i]-'0'; } } cout << ans << endl; return 0; }