#include <stdio.h>

int main(){
  int a[100], p;
  char s[199];
  while(scanf("%s", s) != EOF){
    printf("%c", s[0]);
    switch(s[0]){
      case '+':
        a[p-1] = a[p-1] + a[p];
        p--;
        break;
      case '-':
        a[p-1] = a[p-1] - a[p];
        p--;
        break;
      case '*':
        a[p-1] = a[p-1] * a[p];
        p--;
        break;
      default:
        p++;
        a[p] = atoi(s);
        break;
    }
  }
  printf("%d\n", a[p]);
  return 0;
}