#include #include #include #include #include #include #include #include #include using namespace std; int main() { int n; cin >> n; vector v; for (int i = 0; i < n; i++){ string s; cin >> s; if (s[0] >= '0' && s[0] <= '9') v.push_back(stoll(s)); else if (s == "-"){ int t1, t2; t1 = v.back(); v.pop_back(); t2 = v.back(); v.pop_back(); v.push_back(t2 - t1); } else { int t1, t2; t1 = v.back(); v.pop_back(); t2 = v.back(); v.pop_back(); v.push_back(t2 + t1); } } cout << v[0] << endl; }