#include <bits/stdc++.h> using namespace std; using lint = long long int; template<class T = int> using V = vector<T>; template<class T = int> using VV = V< V<T> >; template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); } template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); } using Itr = string::const_iterator; int expr(Itr& itr); int term(Itr& itr); int num(Itr& itr); int expr(Itr& itr) { int res = term(itr); while (true) { if (*itr == '+') res += term(++itr); else if (*itr == '-') res -= term(++itr); else break; } return res; } int term(Itr& itr) { int res; if (*itr == '(') { res = expr(++itr); ++itr; } else res = num(itr); return res; } int num(Itr& itr) { return *itr++ - '0'; } int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); string s; cin >> s; Itr itr = cbegin(s); cout << expr(itr) << '\n'; }