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

#define MAX 101
void initialize(void);
void push(int);
void pop(void);
int isEmpty(void);
int isFull(void);
int S[MAX];
int top;

int main(void)
{
	char s[MAX];
	int i,x,y,z;
	initialize();
	while(scanf("%c",&s[MAX])!=EOF){
		if(s[0]=='+'){
			y = pop();
			x = pop();
			y = x+y;
		}
		
		else if(s[0]=='-'){
			y= pop();
			x = pop();
			y = x-y;
		}
		else if(s[0]=='*'){
			y=pop();
			x=pop();
			y=x*y;
		}
		
		else x = atoi(s);
		
		push(x);
	}
	printf("%d\n",S[top]);
		
	return 0;
}


void initialize(){
	top = 0;
}

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

int isFull(){
	if(top >= MAX-1) return 1;
}

void push(int x){
	if(isFull()==1){
		printf("error overfllow\n");
	}
	else 
	{
		top++;
		S[top] = x;
	}
}

int pop(){
	if(isEmpty()==1){
		printf("error underflow\n");
	}
	else
	{
		top--;
		return S[top+1];
	}
}