#include <stdio.h>
#include <stdlib.h>
  int   main() {
  int i=0,j,num=0, work;
  int calc[100];
  char data[100];

  while(scanf("%c", &data[i]) != EOF){
      i++;
    }

  for(j=0; j<i; j++){
      if(data[j] > 48 && data[j] <57){
        calc[num] = (int)(data[j]-48);
        num++;
      }

      else{
        switch (data[j]) {
          case '+' :
            work = calc[num-2] + calc[num-1];
            calc[num-2] = work;
            num-=1;
            break;
          case '-' :
            work = calc[num-2] - calc[num-1];
            calc[num-2] = work;
            num-=1;
            break;
          case '/' :
            work = calc[num-2] / calc[num-1];
            calc[num-2] = work;
            num-=1;
            break;
          case '*' :
            work = calc[num-2] * calc[num-1];
            calc[num-2] = work;
            num-=1;
            break;
          }
        }
      }

  printf("%d\n", calc[0]);



  return 0;
}