#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 199

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

int S[100],top;

int main(){
  char temp[100];
  int i,a,b;

  initialize();
  
  while(scanf("%s",temp) != EOF){
    if(temp[0] >= '0' && temp[0] <= '9'){
      push(atoi(temp));
    }
    else{
      b = pop();
      a = pop();
      if(temp[0] == '+'){
	push(a+b);
      }
      if(temp[0] == '-'){
	push(a-b);
      }
      if(temp[0] == '*'){
	push(a*b);
      }
      if(temp[0] == '/'){
	push(a/b);
      }
    }
  }

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

void initialize(){
  top = 0;
}

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

char isFull(){
  return top >= MAX - 1;
}

void push(int x){
  if(isFull()){
    printf("エラー(オーバーフロー)");
  }
  else {
    top++;
    S[top] = x;
  }
}

int pop(){
  if(isEmpty()){
    printf("エラー(アンダーフロー)");
    return 0;
  }
  else {
    top--;
    return S[top+1];
  }
}

  

