x#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define MAX 100


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

void plus();
void minus();
void times();

int S[100],top;

int main (){
  char x;
  int i;

  initialize();

  for(i=0;i<100;i++){
    if(scanf("%c",&x) == EOF) break;
    //数字かの判定
    if(isdigit(x) == 1){
      push(x);
    }
    
    else if(x == '+'){
      plus(); 
    }
    else if(x == '-'){
      minus(); 
    }
    else if(x == '*'){
      times(); 
    }
  }
  return 0;
}

void initialize(){
  top = 0;
}

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

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


int push(x){
  if(isFull() == 0){
    exit(1);
  }
  top++;
  S[top] = x;
}

int pop(){
  if (isEmpty() == 0){
    exit(2);
  }
  top--;
  return S[top+1];
}

void plus(){
  int a,b,c;

  a = pop();
  b = pop();

  c = a + b;

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

void minus(){
  int a,b,c;

  a = pop();
  b = pop();

  c = b - a;

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

void times(){

  int a,b,c;

  a = pop();
  b = pop();

  c = a * b;

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