#include<bits/stdc++.h>
#define endl enjoy_codeforces
using lint=long long;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::string s;std::cin>>s;
    std::vector<lint>stack;
    stack.push_back(0);
    for(char c:std::string(s.rbegin(),s.rend())){
        if('0'<=c&&c<='9'){
            stack.push_back(c-'0');
        }else if (c==')'){
            stack.push_back(0);
        }else{
            assert(2u<=stack.size());
            lint x=stack.back();stack.pop_back();
            stack.back()+=(c=='-'?-1:1)*x;
        }
    }
    std::cout<<stack.at(0)+stack.at(1)<<'\n';
}