#include<bits/stdc++.h>
using namespace std;
long long t[260];
string s;
long long TWT(string s)
{
long long i=0,top=0,x=0;
while(i<s.size()-1)
{
if(s[i]<='9'&&s[i]>='0') x=x*10+int(s[i]-'0');
else{
if(s[i]==' '){
top++;
t[top]=x;
x=0;
}
else{
if(s[i]=='*') t[top-1]=t[top-1]*t[top];
else if(s[i]=='-') t[top-1]=t[top-1]-t[top];
else if(s[i]=='+') t[top-1]=t[top-1]+t[top];
else if(s[i]=='/') t[top-1]=t[top-1]/t[top];
top--;
}
}
i++;
}
return t[top];
}
int main()
{
getline(cin,s);
cout<<TWT(s);
return 0;
}
全错QWQ