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

#define MAX 100

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

int top=0;
int s[MAX];

int main(){
  int x,a,b,i;
  char in;

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

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

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

void push(int x)
{
  
  if(isFull())
    {
      printf("Stack Over Flow!\n");exit(1);
    }
  top++;
  s[top] = x;
}

int pop()
{
  if(isEmpty())
    {
      printf("Stack Under Flow!\n");exit(2);
    }
  top--;
  return s[top+1];
}



