#include<stdio.h>
#include<stdlib.h>
int isEmpty();
int isFull();
void push(int x);
int pop();
int top;
int S[10000];
#define MAX 10000
void initialize(){
	top=0;
}
int isEmpty(){
	return top==0;
}
int isFull(){
	return top >=MAX-1;
}
void push(int x){
	if(isFull()){
		printf("The queue is full");
	}else{
		top++;
		S[top]=x;
	}
}
int pop(){
	if(isEmpty()){
		printf("The quque is Empty");
	}
	top--;
	return S[top+1];
}

int main(){
	char S[100];
	int a,b,n;
	initialize();
	while(scanf("%s",S)!=EOF){
		if(S[0]=='+'){
			a=pop();
			b=pop();
			push(a+b);
		}else if(S[0]=='-'){
			a=pop();
			b=pop();
			push(a-b);
		}else if(S[0]=='*'){
			a=pop();
			b=pop();
			push(a*b);
		}else{
			n=atoi(S);
			push(n);
		}
	}
	printf("%d\n",pop());
	return 0;
}