#include<stdio.h>
#define L 200
void push(int,int,char[]);
int pop(int,char[]);
char in,o1,o2;
int main(){
  char S[L];
  int top=0;
  while(scanf("%s",S)!=EOF){
    if(S[0] == '+'){
      push(pop(top,S)+pop(top,S),top,S);
    }
    else if(S[0] == '-'){
      push(pop(top,S)-pop(top,S),top,S);
    }
    else if(S[0] == '*'){
      push(pop(top,S)*pop(top,S),top,S);
    }
    else push(in,top,S);
  }
  printf("%d\n",pop(top,S));
  return 0;
}
void push(int x,int top,char S[L]){
  top++;
  S[top]=x;
}
int pop(int top,char S[L]){
  top--;
  return (int)(S[top+1]);
}

