
#include <stdio.h>
#define MAX 100

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

int top = 0, S[MAX];

int main()
{
  int  x, y, z;
  char a[MAX];

  while(scanf("%s",a) != EOF){
    if(a[0] == '+'){
      x = pop();
      y = pop();
      push(y+x);
    }
      if(a[0] == '-'){
	x = pop();
	y = pop();
	push(y-x);
      }
      if(a[0] == '*'){
	x = pop();
	y = pop();
	push(y*x);
      }
      else{
       
	push(atoi(a));
      }
    }
  
  printf("%d\n",S[1]);

  return 0;
}

int isEmpty()
{
  if(top == 0){
    return 1;
  }
  else{
    return 0;
  }
}

int isFull()
{
  if(top >= MAX - 1){
    return 1;
  }
  else{
    return 0;
  }
}

void push(int x)
{
  if(isFull() == 1){
    printf("overflow\n");
  }
  top++;
  S[top] = x;
}

int pop(int x)
{
  if(isEmpty() == 1){
    printf("underflow\n");
  }
  top--;
  return S[top+1];
}