#include <stdio.h>
#include <stdlib.h>

int main(){
  int stack[101], s_top = 0, x, i;
  char n;

  while ((scanf("%s" ,&n) != EOF){
    if(n == '+'){
      s_top -= 1;
      x = stack[s_top];
      x += stack[s_top + 1];
    }
    else if(n == '-'){
      s_top -= 1;
      x = stack[s_top];
      x -= stack[s_top + 1];
    }
    else if(n == '*'){
      s_top -= 1;
      x = stack[s_top];
      x *= stack[s_top + 1];
    }
    else{
      x = atoi(&n);
      s_top += 1;
    }
    stack[s_top] = x;


    printf("%d\n" ,stack[s_top]);
  }
  return 0;
}