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

void push(int x);
int pop(void); 
int isEmpty(void);
int isFull(void);

int s[MAX];
int top=0;

int main(){
  char b[1000000];
  int i;

  while(scanf("%s",b)!=EOF &&isFull() ==0){
    i = atoi(b);
    if(i != 0)
      push(i);
    else if(b == "0")
      push(0);
    else if("+" == b)
      push(pop() + pop());
    else if("-" == b)
      push(pop() - pop());
    else if("*" == b)
      push(pop() * pop());
  }

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

  return 0;
}
void push(int x){

  if(isFull()==1)
    printf("オーバーフロー\n");
  
  s[++top] = x;

}
int pop(void){
  if(isEmpty() == 1)
    printf("アンダーフロー\n");

  return s[top--];
}
int isEmpty(void){
  if(top <= 0)
    return 1;
  if(top > 0)
    return 0;
}
int isFull(){
  if(top == MAX-1)
    return 1;
  if(top < MAX-1)
    return 0;
}