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

#define MAX 100;
//グローバル変数
int top;
long int a[MAX];

//topの初期化
void initialize(){
	top = 0;
}

//スタックが空かどうか
int isEmpty(int top){
	if(top == 0){
		return 1;
	}
	else{
		return 0;
	}
}

//スタックが満杯かどうか
int isFull(int top){
	if(top >= MAX - 1){
		return 1;
	}
	else{
		return 0;
	}
}

//配列に数字を入れる
void push(long int ope){
	if(!(isFull(top))){
		top++;
		a[top] = ope;
	}
}

//配列から数字を取り出す
long int pop(){
	if(!(isEmpty(top))){
		top--;
		return a[top];
	}
}
int main(){
	long int x,y;
	char s[200];
	
	initialize();
	
	while( scanf("%s", s) != EOF ){
		if ( s[top] == '+' ){
			y = pop();
			x = pop();
			x = x + y;
			push(x);
		}
		else if ( s[top] == '-' ){
			y = pop();
			x = pop();
			x = x - y;
			push(x);
		}
		else if ( s[top] == '*' ){
			y = pop();
			x = pop();
			x = x * y;
			push(x);
		}
		else {
			x = atoi(s);
			push(x);
		}
	}
	return 0;
}

