#include <stdio.h>

typedef struct {
  int data[100100];
  int size;
} Stack;

void init(Stack* st) {
  st->size = 0;
}
int top(Stack* st) {
  return st->data[st->size - 1];
}
void pop(Stack* st) {
  st->size--;
}
void push(Stack* st, int v) {
  st->data[st->size] = v;
  st->size++;
}

int is_operator(char* s) {
  return *s == '+' || *s == '-' || *s == '*';
}
int eval_operator(char op, int a, int b) {
  if (op == '+') return (a + b);
  if (op == '-') return (a - b);
  if (op == '*') return (a * b);
  return printf("sine\n");
}

int main(void)
{
  Stack calc_;
  Stack* calc = &calc_;
  char token[16];
  
  init(calc);
  while (scanf("%s", token) == 1) {
    if (is_operator(token)) {
      int lhs, rhs;
      rhs = top(calc);
      pop(calc);
      lhs = top(calc);
      pop(calc);
      push(calc, eval_operator(token[0], lhs, rhs));
    } else {
      push(calc, atoi(token));
    }
  }
  printf("%d\n", top(calc));
  return 0;
}