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

int S[MAX];
int top;

int initialize();
int isEmpty();
int isFull();
void push(int);
char pop();
int main(){
  int x,sub;
  char s[1];

  initialize();
  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      push(pop() + pop());
      //printf("%d %d\n",pop(),pop());/*debug*/
    }else if(s[0] == '-'){
      sub = pop();
        push(pop() - sub);
    }else if(s[0] == '*'){
        push(pop() * pop());
    }else{
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",S[top]);
  return 0;
}
int initialize(){
  top = 0;
}
int isEmpty(){
  return top == 0;
}
int isFull(){
  return top >= MAX - 1;
}
void push(x){
  if(isFull()){
    //printf("over fllow\n");
    //exit(0);
  }
  //printf("push:%d\n",x);
  top++;
  printf("push:%d ,%d\n",x,top);/*debug*/
  S[top] = x;
}
char pop(){
  if(isEmpty()){
    //printf("under fllow\n");
    //exit(0);
  }
  top--;
   printf("pop :%d ,%d\n",S[top+1],top+1);/*debug*/
  return S[top+1];
}