#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;
   //printf("b=%d\n",b);
    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';
        //printf("boxは？=%d,thwけっか%d\n",box[i],thw(s-i,tmp));
        bt += thw(s-i,tmp);
       // printf("bt=%d\n",bt);
    }
    A[cnt] = bt;
   // printf("box=%c,Acnt=%d,s=%d,cnt=%d\n\n",box[0],A[cnt],s,cnt);
}

int main()
{
    char box[10],tmp;
    int A[101],s=0,cnt=0,flg=0;
    while((tmp = getchar()) != EOF)
    {
        //printf("tmpの中＝%c\n",tmp);
        if('0' <= tmp && tmp <= '9'){
            //printf("a\n");
            box[s] = tmp;
            s += 1;
            flg=0;
        }else {
            //printf("tmp数%d,+数%d\n",tmp,'+');
            //printf("check1 \n");
            switch(tmp){
                case '+':
           // printf("check2 \n");
                    cnt -=1;
                    //printf("Acnt=%dAcnt+1=%d\n",A[cnt-1],A[cnt]);
                    A[cnt-1]=A[cnt-1]+A[cnt];
                    //printf("計算結果=%d\n",A[cnt-1]);
                    //printf("cntの数=%d\n",cnt);
                    flg = 1;
                    break;
                case '-':
            //printf("check3 \n");
                    cnt -=1;
                    //printf("Acnt=%dAcnt+1=%d\n",A[cnt-1],A[cnt]);
                    A[cnt-1]=A[cnt-1]-A[cnt];
                    //printf("計算結果=%d\n",A[cnt]);
                    //printf("cntの数=%d\n",cnt);
                    flg = 1;
                    break;
                case '*':
            //printf("check4 \n");
                    cnt -=1;
                    //printf("Acnt=%dAcnt+1=%d\n",A[cnt-1],A[cnt]);
                     A[cnt-1]=A[cnt-1]*A[cnt];
                    ///printf("計算結果=%d\n",A[cnt+1]);
                    //printf("cntの数=%d\n",cnt);
                    flg = 1;
                    break;
                case '/':
            //printf("check5 \n");
                    cnt -=1;
                   // printf("Acnt=%dAcnt+1=%d\n",A[cnt-1],A[cnt]);
                     A[cnt-1]=A[cnt-1]/A[cnt];
                    //printf("計算結果=%d\n",A[cnt-1]);
                    //printf("cntの数=%d\n",cnt);
                    flg = 1;
                    break;
                default :
                if(flg == 0){
            //printf("check default\n");
                    chng(box,A,s,cnt);
                    break;
                }
            }
            if(flg == 0)    cnt +=1;//printf("flg通過\n");}            //printf("cnt chk2=%d\n",cnt);
            s = 0;
            }
        }
    printf("%d\n",A[0]);
}
