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

int main(void) {

	char siki[200];
	int kazu[200], i = 0;

	while (scanf_s("%s", siki) != EOF) {
		switch (siki[0]) {
		case '+':
			kazu[i - 2] += kazu[i - 1];
			i--;
			break;
		case '-':
			kazu[i - 2] -= kazu[i - 1];
			i--;
			break;
		case '*':
			kazu[i - 2] *= kazu[i - 1];
			i--;
			break;
		default:
			kazu[i] = atoi(siki);
			i++;
			break;
		}
	}

	printf("%c\n", siki[0]);
	scanf_s("%s", siki);
	return 0;
}