#include<stdio.h>
#include<stdlib.h>
#define MAX 1000000

int stuck[MAX];
int top=0;

void push(int);
int pop(void);

int main(){
  int x,a,b;
  char s[100];

  while( scanf("%s", s) != EOF ){
    
    if ( s[0] == '+' ){
      push(pop()+pop());
    } else if ( s[0] == '-' ){
      a = pop();
      b = pop();
      push(b-a);
    } else if ( s[0] == '*' ){
      push(pop()*pop());
    } else {
      x = atoi(s);
      push(x);
    }

  }
  printf("%d\n",pop());

  return 0;
}

void push(int in){
  if(top==MAX-1){
    printf("満杯\n");
  }else{
    top++;
    stuck[top]=in;
  }
}

int pop(){
  int rn;
  if(top==0){
    printf("空\n");
    rn=0;
  }else{
    rn=stuck[top];
    top--;
  }
  return rn;
}

