#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int S[100];
int top = 0;
void push(int);
int main(){
  char c;
  int a,b;
  int x;
  int flug=0;
  while( flug==0){
    c=getchar();
    if(isdigit(c)){
      ungetc(c,stdin);
      scanf("%d",&x);
      push((int)x);
    }
    else {
      switch(c){
      case '+':
	a = pop();
	b = pop();
	push(b+a);
	break;
      case '-':
	a = pop();
	b = pop();
	push(b-a);
	break;
      case '*':
	a = pop();
	b = pop();
	push(b*a);
	break;
      case ' ':
	break;
      case '\n':
	printf("%d\n",pop());
	flug = 1;
	break;
      default:
	printf("no entery\n");
	break;
      }
	
    }
  }
  
  
  return 0;
}

int pop(){
  //   printf("popped\n");
  return S[--top];
}

void push(int c){
  // printf("pushed\n");
  S[top++]=c;
  //  printf("Current top is %d\n",S[top]);
 
}


