#include <stdio.h>
#include <stdlib.h>

void push(int,int *);
int pop(int *);
int isFull(void);

int top=0;


int main(){
  
  int x,data[2];
  int a[100];
  char s[100];

  while(scanf("%s",s)!=EOF){
    if(s[0]=='+'|| s[0]=='-'||s[0]=='*'){
       data[0]=pop(a);
       data[1]=pop(a);
    }

      if(s[0]=='+'){
	push(data[1]+data[0],a);

     }else if(s[0]=='-'){
	push(data[1]-data[0],a);
  
     }else if(s[0]=='*'){
	push(data[1]*data[0],a);

     }else {
	 x = atoi(s);
         push(x,a);
     }
    } 
   printf("\n%d\n",a[1]);
  return 0;
}


int isFull(void){
  if(top>=99)return 0;
  else return 1;
 }

void push(int x,int *a){
  if (isFull()==0) fprintf(stderr,"オーバーフロー\n");
  else top++;
  a[top]=x;
}

int pop(int *a){
  if (isFull()==0) fprintf(stderr,"オーバーフロー\n");
  else top--;
  return a[top+1];
}
 