

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

#define MAX 200

int top;
int S[MAX];

void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int);
int pop(int);
void keisan(char);

int main( ){

  int i,n=0;
  char handan;

  initialize();

  
  for(i=0;i<MAX*2;i++){
    
    scanf("%c",&handan);
    //printf("i = %d\n", i);
    /*if(handan>=48&&handan<=57&&n!=0){
      n=n*10+atoi(&handan);
      printf("wa-i\n");
      printf("%d\n",n);
      }*/
      
    if(handan=='\n')break;
    else if(handan==' '){
      if(n!=0)push(n);
      n=0;
      continue;}

    //printf("wa-i2\n");
    
    else if(handan=='+'||handan=='-'||handan=='*'||handan=='/'){
      keisan(handan);
      // printf("wa-i2\n");
    }
    else{
      if(handan>=48&&handan<=57){
	n=n*10+atoi(&handan);
	//printf("%d\n",n);
      }
      // printf("%d\n",n);
      // printf("wa-i\n");
    }
      
  }

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

void initialize(){
  top=0;
}

int isEmpty(){
  if(top ==0)return 1;
  else return 0;
}

int isFull(){
  if(top>=MAX - 1)return 1;
  else return 0;
}

void push(int x){
  if(isFull() ==1) exit(1);
  
    top++;
    S[top]=x;
    // printf("\n%d\n",S[top]);

}
int pop(int x){

  
  if( isEmpty()==1 ) exit(2);

  top--;
  return S[top+1];
}

void keisan(char hugou){
  
  int n1,n2,n;
  
  n1=pop(S[top]);
  n2=pop(S[top]);

  // printf("%d %d\n",n1,n2);
  
  //printf("wa-i3");

  switch(hugou){

  case '+':
    //printf("wa-i4");
    n=n2+n1;
    //printf("add %d\n",n);
    break;

  case '-':
    n=n2-n1;
    break;

  case '*':
    n=n2*n1;
    break;

  case '/':
    n=n2/n1;
    break;

  }
  
  push(n);
  
}

  


  