#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#define MAX 200
 
int sp = MAX;
int stack[MAX];

 static void push(int n) {
	if(sp > 0) {
		stack[--sp] = n;
	} else {
		fprintf(stderr,"push overflow\n");
	}
}
static int pop() {
	if(sp < MAX) {
		return stack[sp++];
	} else {
		return 0;
	}
}


int main() {
	char s[MAX];
	int i=0,j=0;
	
	while(scanf("%s",s)!=EOF) {
		if(s[0] =='+') {
			push(pop()+pop());
		}else if(s[0] == '-') {
			j = pop();
			i = pop();
			push(i-j);
		}else if(s[0] = '*') {
			push(pop() * pop());
		} else {
			push(atoi(s));
		}
	}
	return 0;
}
