#include <stdio.h>
#include <stdlib.h>
#define MAX 100

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

int top;
int S[MAX] = {0};

int main(void) {
	int x, y;
	char s[10];

	while ( scanf("%s", s) != EOF) {
//		printf("%s", s);
		switch (s[0]) {
		case '+':
			x = pop() + pop();
			push(x);
			break;
		case '-':
			x = pop();
			y = pop();
			x = y - x;
			push(x);
			break;
		case '*':
			x = pop() * pop();
			push(x);
			break;
		default:
			x = atoi(s);
			push(x);
			break;
		}
		
	}
	
	printf("%d\n", S[1]);
	return 0;
}

void initialize() {
	top = 0;
	return;
}

int isEmpty() {
//	printf("isEmpty %d\n", top);
	return top == 0;
}

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

void push(int x) {
	if (isFull()) {
		printf("Over Flow\n");
		exit(-1);
	}

	top++;
//	printf("push x = %d %d\n", x, top);
	S[top] = x;
}

int pop() {
	if (isEmpty()) {
//		printf("Under Flow\n");
		exit(-1);
	}
	top--;
	return S[top+1];	
}