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

#define nummax 100
#define arrmax 99
int top = 0,S[nummax];

void push(int);
void pop();

int main()
{
  int i,j;
  char x,moji[arrmax+nummax],a;

  for( i = 0 ; i < arrmax+nummax ; i++ )
    {

      if(scanf("%c",&moji[i])== EOF) break;
      if( moji[i] == '\n') break;
    }

  for( j = 0 ; j < i ; j+=2 )
    {
	if( moji[j] == '+' )
	  {
	    S[top-1] = S[top-1] + S[top];
	    pop();
	  }
	else if( moji[j] == '-' )
	  {
	    S[top-1] = S[top-1] - S[top];
	    pop();
	  }
	else if( moji[j] == '*')
	  {
	    S[top-1] = S[top-1] * S[top];
	    pop();
	  } 
	else push(atoi(&moji[j]));
    }

  for( i = 1 ; i <= top ; i++ )
  printf("%d\n",S[i]);

  return 0;
}

void push(int x)
{
  if( top >= nummax-1 ) exit(3);
  top++;
  S[top] = x;
}

void pop(void)
{
  if( top == 0 ) exit(2);
  top--; 
}