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

int main(void){
  int i=0,top=0;
  int S[1000];
  int a,b,c;
  char op[1000];


void push(int x){
  top++;
  S[top]=x;
}

int pop(){
  top--;
  return S[top+1];
}


  while(scanf("%c",&op[i])!=EOF){
    if(op[i]=='+'){
      a=pop();
      b=pop();
      c=a+b;
      printf("%d\n",a);
      printf("%d\n",b);
      printf("%d\n",c);
      push(c);
    }else if(op[i]=='-'){
      a=pop();
      b=pop();
      c=b-a;
      printf("%d\n",a);
      printf("%d\n",b);
      printf("%d\n",c);
      push(c);
    }else if(op[i]=='*'){
      a=pop();
      b=pop();
      c=a*b;
      printf("%d\n",a);
      printf("%d\n",b);
      printf("%d\n",c);
      push(c);
    }else if(op[i]=='/'){
      a=pop();
      b=pop();
      c=b/a;
      printf("%d\n",a);
      printf("%d\n",b);
      printf("%d\n",c);
      push(c);
    }else{
      push(atoi(&op[i]));
    }
    i++;
  }

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



  return 0;
}