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