#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define lint long long int /* vectoral(26); al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; vectorAL(26); AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; */ int main() { string s; cin >> s; string S = s; int Z = S.size(); int cnt = 0; for (int i = 1; i < Z; i++) { if (S[i-1] == '-' && S[i]=='(') { cnt++; } else if (S[i] == ')'&&cnt>0) { cnt--; } else if (S[i] == '+' && cnt == 1) { S[i] = '-'; } else if (S[i] == '-' && cnt == 1) { S[i] = '+'; } } int cntc = 0; for (int i = 0; i < Z; i++) { if (S[i] == '(' || S[i] == ')') { cntc++; } } int z = Z - cntc; int cntd = 0; vectorvec(z); for (int i = 0; i < Z; i++) { if (S[i] != '(' && S[i] != ')') { vec[cntd] = S[i]; cntd++; } } int ans = int(vec[0] - '0'); char sc; char si; for (int i = 1; i <= z / 2; i++) { sc = vec[i * 2 - 1]; si = int(vec[i * 2] - '0'); if (sc == '+') { ans += si; } else if (sc == '-') { ans -= si; } } cout << ans << endl; }