#include using namespace std; string s; bool in; int x, y, ans; int main() { cin >> s; ans = 0, x = y = 1; in = false; for (int i = 0; i < s.size(); ++i) { if ('0' <= s[i] && s[i] <= '9') { ans += x * y * (s[i] - '0'); } else if (s[i] == '+') { if (in) y = 1; else x = 1, y = 1; } else if (s[i] == '-') { if (in) y = -1; else x = -1, y = 1; } else if (s[i] == '(') { in = true; } else if (s[i] == ')') { in = false; x = y = 1; } } printf("%d\n", ans); return 0; }