#include<stdio.h>
#include<stdlib.h>
#define N 100

int main(){
  int i,j,f,c=0,top=0;
  char n[N];
  int m,S[N];
  while(scanf("%s",n)!=EOF){
    if(isdigit(n[0])){
      S[top] = atoi(n);
      top++;
    }
    if(n[0] == '+'){
      m = S[top-2] + S[top-1];
      top-=2;
      S[top] = m;
      top++;
    }
    if(n[0] == '-'){
      m = S[top-2] - S[top-1];
      top-=2;
      S[top] = m;
      top++;
    }
    if(n[0] == '*'){
      m = S[top-2] * S[top-1];
      top-=2;
      S[top] = m;
      top++;
    }
    if(n[0] == '/'){
      m = S[top-2] / S[top-1];
      top-=2;
      S[top] = m;
      top++;
    } 
  }
  printf("%-2d\n",m);
}

