#include<stdio.h>
#include<stdlib.h>
#include<string.h>
??
int main(){
????int x, stack[100], i=0;
????char s[100];
??????
????while( scanf("%s", s) != EOF ){
????????if ( s[0] == '+' ){
????????????stack[i-2] = stack[i-2] + stack[i-1];
????????????i -= 1;
????????} else if ( s[0] == '-' ){
????????????stack[i-2] = stack[i-2] - stack[i-1];
????????????i -= 1;
????????} else if ( s[0] == '*' ){
????????????stack[i-2] = stack[i-2] * stack[i-1];
????????????i -= 1;
????????} else {
????????????x = atoi(s);
????????????stack[i] = x;
????????????i++;
????????}
????}
????printf("%d\n", stack[0]);
????return 0;
}