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

int S[100];
int top=0;

void initialize();
int isEmpty();
int isFull();
void push(int x);
int pop();

int main(void){

	char a[100];
	int b,c;

	
	for(;;){
	
		if(scanf("%s",a)==EOF) break;
		
		else if(a[0]=='+') {
		
			b=pop()+pop();
			push(b);
		
		}
		
		else if(a[0]=='-') {
		
			b=pop();
			c=pop();
			push(c-b);
		
		}
		
		else if(a[0]=='/') {
		
			b=pop();
			c=pop();
			push(c/b);
		
		}
		
		else if(a[0]=='*') {
		
			b=pop()*pop();
			push(b);
		
		}
		
		else{
		
			b=atoi(a);
			//printf(" %d",b);
			push(b);
		
		}
		
	}
	
	printf("%d\n",pop());
	

}

int isEmpty(){
	if(top==0) return 1;
	else return 0;
}

int isFull(){
	if(top >= 100){
		return 1;
	}
	else return 0;
}
	
void push(int x){
	if (isFull()==1){
		printf("Error(Over Flow)\n");
		printf("%d",top);
		exit(0);
	}
	else{
		top++;
		S[top] = x;
		//printf("%d %d ",top,S[top]);
	}
}


int pop(){
	if (isEmpty()==1){
		
		printf("Error(Under flow)  top=%d",top);
		exit(0);
	}
	else {
		top--;
		return S[top+1];
	}
}
