#include<iostream>
#include<stack>
using namespace std;
string s;
stack<int> stk;
int main(){
cin >> s;
for(int i = 0; s[i] != '@'; i ++){
if(isdigit(s[i])){
int p = 0;
while(isdigit(s[i])) p = p * 10 + s[i ++] - '0';
stk.push(p);
continue;
}
if(s[i] == '.') continue;
int a = stk.top();
stk.pop();
int b = stk.top();
stk.pop();
switch(s[i]){
case '+' : stk.push(a + b); break;
case '-' : stk.push(b - a); break;
case '*' : stk.push(a * b); break;
case '/' : stk.push(b / a); break;
}
}
cout << stk.top() << endl;
return 0;
}