#include <stdio.h>
#include <stdlib.h>
int main(){
int cal[100], top = 0;
char s[1000000];
while(1){
if(scanf("%s",&s) == EOF) break; 
if(s[0] == '+'){
cal[top-1] = cal[top-1] + cal[top];
top--;
????????}
????????else if(s[0] == '-'){
cal[top-1] = cal[top-1] - cal[top];
top--;
????????}
else if(s[0] == '*'){
cal[top-1] = cal[top-1] * cal[top];
top--;
????????}

????????else cal[++top] = atoi(s);
????}
????????
????printf("%d\n",cal[top]);
????
????return 0;
}