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

#define MAX 128

int top;
char S[MAX] = {0};

void initialize(){
  top = 0;
}

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

int isFull(){
  return MAX - 1 <= top;
}

int push(x){
  if (isFull())
    puts("over flow");
  top++;
  S[top] = x;
  return 0;
}

int pop(){
  if (isEmpty())
    puts("under flow");
  top--;
  return S[top + 1];
}
  
int main(void){
  char x[1];
  int tmp;
  initialize();

  while (scanf("%s", x) != EOF){
    switch(x[0]) {
    case '+':
      push(pop() + pop());
      break;
    case '-':
      tmp = pop();
      push(pop() - tmp);
      break;
    case '*':
      push(pop() * pop());
      break;
    default:
      push(atoi(x));
      break;
    }
  }
  printf("%d\n", pop());
  return 0;
}