#include<stdio.h>
 
int thw(int,int);
void chng(char*,int*,int,int);
 
int thw(int s,int b)
{
    for(int i=1;i<s;i++) b = b * 10;
    return b;
}
 
void chng(char *box,int *A,int s,int cnt)
{
    int tmp,bt=0;
    for(int i=s-1;i>=0;i--)
    {
        tmp = box[i]-'0';
        bt += thw(s-i,tmp);
    }
    A[cnt] = bt;
}
 
int main()
{
    char box[10],tmp;
    int A[101],s=0,cnt=0,flg=0;
    while((tmp = getchar()) != EOF)
    {
        if('0' <= tmp && tmp <= '9'){
            box[s] = tmp;
            s += 1;
            flg=0;
        }else {
            switch(tmp){
                case '+':
                    cnt -=1;
                    A[cnt-1]=A[cnt-1]+A[cnt];
                    flg = 1;
                    break;
                case '-':
                    cnt -=1;
                    A[cnt-1]=A[cnt-1]-A[cnt];
                    flg = 1;
                    break;
                case '*':
                    cnt -=1;
                     A[cnt-1]=A[cnt-1]*A[cnt];
                    flg = 1;
                    break;
                case '/':                    cnt -=1;
                     A[cnt-1]=A[cnt-1]/A[cnt];
                    flg = 1;
                    break;
                default :
                if(flg == 0){
                    chng(box,A,s,cnt);
                    break;
                }
            }
            if(flg == 0)    cnt +=1;
            s = 0;
            }
        }
    printf("%d\n",A[0]);
}

