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

int main(void){

	char S[100];
	int num,i=0,sum,A[100];

	while(scanf("%s",S)!=EOF){
	    num=S[0];
        if('-1'<num && num<'10'){
        A[i]=atol(S);
        i++;
        }
        else{
        switch(num){
            case '+':
            sum=A[i-1]+A[i-2];
            break;

            case '-':
            sum=A[i-1]-A[i-2];
            break;

            case '*':
            sum=A[i-1]*A[i-2];
            break;

            default:
            break;
        }
        A[i-2] = num;
        i++;

        }
	}

	printf("%ld\n",A[0]);

	return 0;
}