#include <bits/stdc++.h>
using namespace std;
unordered_map<char,int> mp{{'+',1},{'-',1},{'*',2},{'/',2}};
stack<int> num;
stack<char> op;
void eval()
{
char oop;
int num1,num2;
num2=num.top();
num.pop();
num1=num.top();
num.pop();
oop=op.top();
op.pop();
int sum;
if(oop=='+')
{
sum=num1+num2;
}
else if(oop=='-')
{
sum=num1-num2;
}
else if(oop=='*')
{
sum=num1*num2;
}
else if(oop=='/')
{
sum=num1/num2;
}
num.push(sum);
}
void solve(string s)
{
for(int i=0;i<s.size();i++)
{
if(isdigit(s[i]))
{
int j=i;
int nu=0;
while(j<s.size()&&isdigit(s[j]))
{
nu=nu*10+s[j]-'0';
j++;
}
i=j-1;
num.push(nu);
}
else //如果遇到的是运算符
{
while(op.size()&&mp[op.top()]>=mp[s[i]]) eval();
op.push(s[i]);
}
}
while(op.size())
{
eval();
}
cout<<num.top()<<endl;
}
int main()
{
string s;
while(cin>>s)
{
while(num.size())
{
num.pop();
}
while(op.size())
{
op.pop();
}
solve(s);
}
return 0;
}