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

int main(){
  int x,stack[100],stack2[100],i=0,j=0,ans=1;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      stack2[j++] = stack[i-2] + stack[i-1];
    } else if ( s[0] == '-' ){
      stack2[j++] = stack[i-2] - stack[i-1];
    } else if ( s[0] == '*' ){
      //stack2[j++] = stack[i-2] * stack[i-1];
    } else {
      stack[i++] = atoi(s);
    }
  }

  for (i=0;i<j;i++){
    ans *= stack2[i];
  }

  printf("%d\n",ans);
  return 0;
}