#include <stdio.h>
#include <stdlib.h>
#define MAX 100

void push (int);
int pop (void);
int isempty (void);


int stack[MAX];
int idx = 0;

int main () {
  char c,sp;
  int a, b,cnt=0;
  

	while (1) {
	loop:
	  if ((c = getchar()) != EOF) {
	    
	    // is num
	    if(c==' '){
	      goto loop;//??\??????1 2 +?????¨???
	    }else if (c == '\n') {
	      break;
	    } else if (c == '+') {
	      push(pop()+pop());
	    } else if (c == '-') {
	      a = pop();
	      b = pop();
	      push(b-a);
	    } else if (c == '*') {
	      push(pop()*pop());
	    } else if (c == '/') {
	      push(pop()/pop());
	    } else if (atoi(&c) >= 0 && atoi(&c) <= 9) {
	      //printf("%d\n", atoi(&c));
	      push (atoi(&c));
	    } else {
	      printf ("Unsupported charactor!\n");
			}

		} else {

	    break;
	  }
	  
	}
	printf("%d\n",stack[0]);
}
void push (int x) {
	//printf ("push v:%d idx:%d\n", x, idx);
  stack[idx] = x;
  idx ++;
  return;
}
int pop () {
  if (isempty() == 1) return NULL;
  idx --;
  //printf ("pop  v:%d idx:%d\n", stack[idx], idx);
	int t = stack[idx];
	stack[idx] = NULL;
	return t;
}
int isempty () {
  if (idx == 0) return 1;
  else return 0;
}