#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 101

int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);

int top=0;
int S[MAX]={};

int main(){
  int x,ans;
  char s[100];
  while(scanf("%s", s)!=EOF){
    if (s[0] == '+' ){
      push(pop()+pop());
    } else if ( s[0] == '-' ){
      ans=pop()-pop();
      push(ans*(-1));
    } else if ( s[0] == '*' ){
      push(pop()*pop());
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",pop());
  return 0;
}

int isEmpty(void){
  return top==0;
}

int isFull(){
  return top>=MAX-1;
}

void push(int x){
  if(isFull()){
    printf("is full!\n");
    exit(1);
  }
  top++;
  S[top]=x;
  //  printf("%d ",top);
}

int pop(){
  if(isEmpty()){
    printf("is Empty!\n");
    exit(2);
  }
  top--;
  return S[top+1];
}

