#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define N 150
void push(int);
int pop(void);
int isFULL(void);
int isEMPTY(void);
int top=0;
int S[N];
int main()
{
  int x,a,b,c;
  char s[N];
  while(scanf("%s",s)!=EOF)
    {
      if(s[0]=='+')
	{
	  a=pop();
	  b=pop();
	  c=b+a;
	  push(c);
	}
      else if(s[0]=='-')
	{
	  a=pop();
	  b=pop();
	  c=b-a;
	  push(c); 
	}
      else if(s[0]=='*')
	{
	  a=pop();
	  b=pop();
	  c=b*a;
	  push(c); 
	}
      else
	{
	  x=atoi(s);
	  push(x);
	}
    }
  printf("%d",S[1]);
  printf("\n");
  return 0;
}
void push(int x)
{
  if(isFULL()==1)
    {
    printf("over flow!\n");
    exit(1);
    }
  top++;
  S[top]=x;
}
int pop(void)
{
  if(isEMPTY()==1)
    {
      printf("under flow!\n");
      exit(2);
    }
  top--;
  return S[top+1];
}
int isFULL(void)
{
  if(top>=N-1)
    return 1;
  else return 0;
}
int isEMPTY(void)
{
  if(top==0)
    return 1;
  else return 0;
}

