#include<stdio.h>
#define MAX 100

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

int s[MAX];
int top=1;

int main(){
  char b;


  while(scanf("%c",&b)!=EOF && isEmpty()&&isFull() ==0){
    if(b >= 48 && b <=57)
      push(b - 48);
    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 <= 1)
    return 1;
  if(top > 1)
    return 0;
}
int isFull(){
  if(top == MAX-1)
    return 1;
  if(top < MAX-1)
    return 0;
}