#include<iostream>
#include<cstdio>
#include<stack>
#include<string>
using namespace std;
int GetOrder(char x){
if(x=='#'){
return 1;
}
else if(x=='$'){
return 2;
}
else if(x=='+'||x=='-'){
return 3;
}
else{
return 4;
}
}
double GetNumber(string str,int &i){
int number=0;
while(str[i]>='0'&&str[i]<='9'){
number=number*10+str[i]-'0';
++i;
}
return number;
}
double Calculate(double x,double y,char op){
if(op=='+'){
return x+y;
}
else if(op=='-'){
return x-y;
}
else if(op=='*'){
return x*y;
}
else{
return x/y;
}
}
using namespace std;
int main(){
string str;
stack<double> number;
stack<char> operate;
while(getline(cin,str)){
while(!number.empty()){
number.pop();
}
while(!operate.empty()){
operate.pop();
}
operate.push('#');
str+="$";
int i=0;
while(i<str.size()){
if(str[i]>='0'&&str[i]<='9'){
number.push(GetNumber(str, i));
}
else{
if(GetOrder(str[i])>GetOrder(operate.top())){
operate.push(str[i]);
++i;
}
else{
double y=number.top();
number.pop();
double x=number.top();
number.pop();
number.push(Calculate(x, y, operate.top()));
operate.pop();
}
}
}
printf("%.0f\n",number.top());
}
return 0;
}