#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int pop();
void push(int);
char s[100];
int main(){
  int x,ans;
  while( scanf("%s", s) != EOF ){
    printf("%d\n",ans);
    if ( s[0] == '+' ){
      push(pop()+pop());
    } else if ( s[0] == '-' ){
      push(pop()-pop());
    } else if ( s[0] == '*' ){
      push(pop()*pop());
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",ans);
  return 0;
}
int pop(){
  char top;
  *s=top;
  top--;
  return top+1;
}
void push(int x){
  char top;
  *s=top;
  top++;
  top=x;
}

