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

#define SIZE 100

void push(int);
int pop();
int top();
int size();
int free_mem();
int empty();
void clear();

int stack[SIZE];
int sp=0;

void push(int x){
	if(sp==SIZE){
		printf("Overflow\n");
		exit(1);
	}
	stack[sp++] = x;
}

int pop(){
	if(sp==0){
		printf("Underflow\n");
		exit(1);
	}
	return stack[--sp];
}

int top(){
	if(sp==0){
		printf("Nodata\n");
		exit(1);
	}
	return stack[sp-1];
}

int size(){
	return sp;
}

int free_mem(){
	return SIZE-sp;
}

int empty(){
	return sp==0;
}

void clear(){
	sp=0;
}

int main(void)
{
	char c;
	int a,b;
	int num;
	while((c=getchar())!='\n'){
		switch (c){
		case '+':
			a=pop();
			b=pop();
			push(a+b);
			break;
			
		case '-':
			a=pop();
			b=pop();
			push(b-a);
			break;
			
		case '*':
			a=pop();
			b=pop();
			push(a*b);
			break;
			
		case ' ':
			break;
			
		default :
			num=c-'0';
			while((c=getchar())!=' '){
				num=num*10+c-'0';
			}
			push(num);
		}
	}
	printf("%d\n",pop());
}