#include<stdio.h>
#include<stdlib.h>
#include<string.h>

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

int top=0;
int S[100];

int main(){
  int a,b;
  char s[100];

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

  return 0;
}
int initialize(void){
  top = 0;
}
int isEmpty(void){
  return top == 0;
}
int isFull(void){
  return top >= 100;
}
void push(int x){
  if(isFull()){
    printf("Overflow\n");
  }
  top++;
  S[top] = x;
}
int pop(void){
  if(isEmpty()){
    printf("Underflow\n");
  }
  top--;
  return S[top+1];
}