#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 x;
 char s[100];

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

int initialize(void)
{
  top = 0;
}

int isEmpty(void)
{
  return top == 0;
}

int isFull(void)
{
  return top >= 99;
}


void push(int x)
{
  if(isFull()) printf("error:overflow\n");

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

int pop(void)
{
  if(isEmpty()) printf("error:underflow\n");
  top--;
  return S[top+1];
}