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

int main(){
  int i = 0, a[100];
  char c[100];

  while(scanf("%s", c) != EOF){

    if(c[0] == '+') {
      a[i-2] = a[i-2] + a[i-1];
      i=i-1;
    }
    else if(c[0] == '-'){
      a[i-2] = a[i-2] - a[i-1];
      i=i-1;
    }
    else if(c[0] == '*'){
      a[i-2] = a[i-2] * a[i-1];
      i=i-1;
    }
    else{
      a[i] = c[0] - 48;
      i++;
    }
  printf("%d\n",a[0]);   
  }
  
  printf("%d\n",a[0]);
  
  return 0;
}