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

/*void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);
int is_digit(char *);*/
int top;  
char S[MAX];


int main(){
  int i,n,a[MAX];
  for ( i = 1; i < MAX ;i++){
    if(scanf("%s",S) == EOF)break;
    printf("%s",S);
    if (S[0] == '+'){
      a[i-2] = a[i-2]+a[i-1];
      i-=2;
    } 
    else if (S[0] == '-'){
      a[i-2] = a[i-2]-a[i-1];
      i-=2;
    }
    else if (S[0] == '*'){
      a[i-2] = a[i-2]*a[i-1];
      i-=2;
    }
    else a[i] = atoi(S);

  }  
  printf("%d\n",a[1]);


}


/*}initialize(){

    top = 0
    }
isEmpty(){
  return top == 0;
}

isFull(){
  return top >= MAX - 1;
}
push(int x){
  if( isFull())
    printf("overflow\n");
  top++;
  S[top] = x;
}
pop(){
  if (isEmpty())
    printf("overflow\n");
  top--;
  return S[top+1];
}
*/