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

	int top = -1;
	int push(int);
	int pop(void);
	char in[6];
	int stack[100];

int main(void){
	
	while(scanf("%s",in)){
	
	if(in[1] == '+'){
		
		stack[top-1] = stack[top]+stack[top-1];
		top--;
		
		}
		
	else if(in[1] == '-'){
		
		stack[top-1] = stack[top]-stack[top-1];
		top--;
		
		}
	
	else if(in[1] == '*'){
		
		stack[top-1] = stack[top]*stack[top-1];
		top--;
		
		}
	
	else{
		
		push(atoi(in));
		
		}
	
	}
	
	printf("%d\n",pop());
	
return 0;}


int push(int plus){
	
	top++;
	stack[top] = plus;
	
return 0;}


int pop(void){
	
	int n;
	n = stack[top];
	stack[top] = NULL;
	top--;
	
return n;}