#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define M 100

void push(int);
int pop(void);
int A[M];
int top=0;

int main()
{
  int i,x,y,z;
  char s[M];
  while(scanf("%s",s)!=EOF)
    {
      if(s[0]==' ') i++;
      if(s[0]=='+')
	{
	  x=pop();
	  y=pop();
	  push(x+y);
	}
     else if ( s[0]=='-')
       {
	 x=pop();
	 y=pop();
	 push(y-x);
       }
     else if ( s[0]=='*')
       {
         x=pop();
	 y=pop();
	 push(x*y);
       }
     else
       {
      z=atoi(s);
      push(z);
       }
    }
  printf("%d\n",pop());
  return 0;
}

int pop()
{
  if(top==0)
    {
      printf("Stack is empty\n");
      exit(1);
    }
  top--;
  return A[top+1];
}

void push(int x)
{
  if(top==100)
    {
      printf("Stack overflow\n");
      exit(1);
    }
  top++;
  A[top]=x;
}
    

