#include<stdio.h>
int main(void){
    char c;
    int a[2000];
    int i=0;
    while((scanf("%c ", &c))!=null){
    if(isdigit(c)){
        a[i]=atoi(c);
        i++;
    }
    else{
        Switch(c){
        case '%':
        a[i-1]=a[i]/a[i-1];
        i--;
        case '*':
        a[i-1]=a[i]*a[i-1];
        i--;
        case '+'
        a[i-1]=a[i]+a[i-1];
        i--;
        case '-':
        a[i-1]=a[i]-a[i-1];
        i--;
        defalt:
}

    }
}
    printf("%d\n"a[i]);
    return 0;
}