#include using namespace std; typedef long long ll; #define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++) #define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++) #define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--) #define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--) #define all(x) (x).begin(), (x).end() #define sz(x) ((ll)(x).size()) #define len(x) ((ll)(x).length()) ll f(string s) { ll tmp = 0, ans = 0; bool plus = false, minus = false; s += "="; rep(i, len(s)) { if ((s[i] >= '0') && (s[i] <= '9')) { tmp = tmp * 10 + (s[i] - '0'); continue; } if ((!plus) && (!minus)) ans = tmp; else if (plus) ans += tmp; else ans -= tmp; plus = false; minus = false; if (s[i] == '+') plus = true; else if (s[i] == '-') minus = true; tmp = 0; } return ans; } int main() { cin.tie(0); ios::sync_with_stdio(false); // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); string s; cin >> s; string ns = "", tmp = ""; bool in = false; rep(i, len(s)) { if (s[i] == '(') { in = true; tmp = ""; } else if (s[i] == ')') { ll v = f(tmp); ns += to_string(v); in = false; } else { if (in) tmp += s[i]; else ns += s[i]; } } cout << f(ns) << endl; return 0; }