#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char S[1000];
int top=0;

void push(int x){
    S[++top]=x;
}

int pop(){
    top--;
    return S[top+1];
}

int main(void){
    char s[100];
    int a,b;
    int i;

    while(scanf("%s",s)!=EOF){
        printf("--%c\n",s[0]);
        if(s[0]=='+'){
            a=pop();
            b=pop();
            printf("%d\n",a+b);
            push(a+b);
        }else if(s[0]=='-'){
            b=pop();
            a=pop();
            printf("%d\n",a-b);
            push(a-b);
        }else if(s[0]=='*'){
            a=pop();
            b=pop();
            printf("%d\n",a*b);
            push(a*b);
        }else{
            push(atoi(s));
        }
    }

    printf("%d\n",pop());
    return 0;
}