#include<iostream>
#include<stack>
#include<stack>
using namespace std;
int main(void){
stack <int> sta;
char s[50];
int i , num, a, b, c, sum;
stack <int> sta;
char s[50];
int i , num, a, b, c, sum;
cin >> s;
i = 0;
i = 0;
while (s[i] != '\0'){
num = s[i] - '0';
if (num >= 0 && num <= 9){
sta.push(num);
}
if (s[i] == '+'){
a = sta.top();
sta.pop();
b = sta.top();
sta.pop();
c = b + a;
sta.push(c);
}
if (s[i] == '-'){
a = sta.top();
sta.pop();
b = sta.top();
sta.pop();
c = b - a;
sta.push(c);
}
if (s[i] == '*'){
a = sta.top();
sta.pop();
b = sta.top();
sta.pop();
c = b * a;
sta.push(c);
}
num = s[i] - '0';
if (num >= 0 && num <= 9){
sta.push(num);
}
if (s[i] == '+'){
a = sta.top();
sta.pop();
b = sta.top();
sta.pop();
c = b + a;
sta.push(c);
}
if (s[i] == '-'){
a = sta.top();
sta.pop();
b = sta.top();
sta.pop();
c = b - a;
sta.push(c);
}
if (s[i] == '*'){
a = sta.top();
sta.pop();
b = sta.top();
sta.pop();
c = b * a;
sta.push(c);
}
if (s[i] == '/'){
a = sta.top();
sta.pop();
b = sta.top();
sta.pop();
c = b / a;
sta.push(c);
}
i++;
}
a = sta.top();
sta.pop();
b = sta.top();
sta.pop();
c = b / a;
sta.push(c);
}
i++;
}
sum = sta.top();
cout << sum << endl;
cin.get();
system("pause");
return 0;
}
cout << sum << endl;
cin.get();
system("pause");
return 0;
}