#include <stdio.h>

void push(int);
int pop();

int top=0,S[100];

int main(){
  int m,n;
  char x[7];

  while(scanf("%s",x)!=EOF){
    if(x[0]>=49&&x[0]<=57) push(atoi(x));
    else{
      m=pop();
      n=pop();

      if(x[0]==42) push(n*m);
      else if(x[0]==43) push(n+m);
      else push(n-m);
    }
  }

  printf("%d\n",S[1]);
  
  return 0;
}

void push(int x){
  top++;
  S[top]=x;
}

int pop(){
  top--;
  return S[top+1];
}