#include <bits/stdc++.h>
using namespace std;
using LL = int64_t;
string str;
string a="";
stack<int>st;
int main() {
cin >> str;
for(int i = 0; str[i] != '@'; ++i) {
if(str[i] == '.') {
st.push(stoi(a));
a.clear();
}
else if(isdigit(str[i])) a += str[i];
else {
int x = st.top(); st.pop();
int y = st.top(); st.pop();
if(str[i] == '-') {
if(isdigit(str[i + 1])) a += '-';
else st.push(y - x);
}
if(str[i] == '+') st.push(y + x);
if(str[i] == '*') st.push(y * x);
if(str[i] == '/') st.push(y / x);
}
}
cout << st.top() << '\n';
return 0;
}