#include<bits/stdc++.h>
using namespace std;
int st[101];
char s[256];
int comp(char s[256]) {
int i=0,top=0,x,y;
while(i<=strlen(s)-2) {
switch(s[i]) {
case '+':st[--top]+=st[top+1];break;
case '-':st[--top]-=st[top+1];break;
case '*':st[--top]*=st[top+1];break;
case '/':st[--top]/=st[top+1];break;
default:x=0;while(s[i]!=' ') x=x*10+s[i++]-'0';st[++top]=x;break;
}
i++;
}
return st[top];
}
int main() {
gets(s);
printf("%d",comp[s]);
return 0;
}