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

int main()
{
	char str[8];
	int top = 0, stack[100];

	while(scanf("%s", str) != EOF)
	{
		switch(str[0])
		{
			case '+': --top; stack[top-1] = stack[top-1] + stack[top]; break;
			case '-': --top; stack[top-1] = stack[top-1] - stack[top]; break;
			case '*': --top; stack[top-1] = stack[top-1] * stack[top]; break;
			case '/': --top; stack[top-1] = stack[top-1] / stack[top]; break;
			default:  stack[top++] = atoi(str); break;
			
		}
	}
	printf("%d\n", stack[0]);
}


