#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define MAX 200

int top=0;
int a[MAX];

void push(int x){
  
  if(top >= MAX - 1){
    printf("overflow\n");
    exit(1);
  }

  top++;
  a[top] = x;
  
}

int pop(){

  if(top == 0){
    printf("overflow\n");
    exit(1);
  }

  top--;
  return a[top+1];
  
}

int main(){

  int a,b,x,n;
  char s[MAX];

  while(scanf(" %s",s) != EOF){

    if(s[0] == '+'){
      b=pop();
      a=pop();
      push(a+b);
    } else if(s[0] == '-'){
      b=pop();
      a=pop();
      push(a-b);
    } else if(s[0] == '*'){
      b=pop();
      a=pop();
      push(a*b);
    } else {
      x=atoi(s);
      push(x);
    }
    
  }//while

  n=pop();
  printf("%d\n",n);

  return 0;

}


