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

typedef struct {
  int *INFO;
  int TOP;
}Stack;

#define top(s) (s).TOP
#define infotop(s) (s).INFO[top(s)]

void init(Stack *s,int sizes)
{
  top(*s) = 0;
  (*s).INFO = calloc(sizes,sizeof(int));
}

void push(Stack *s,int value)
{
  top(*s)++;
  infotop(*s) = value;
}

void pop(Stack *s,int *value)
{
  (*value) = infotop(*s);
  top(*s)--;
}

void do_stack(char *data)
{
  char temp[2];
  int i,j,k;
  Stack s;
  init(&s,strlen(data));
  for(i = 0; data[i] != '\0'; i++){
    temp[0] = data[i];
    temp[1] = '\0';
    if(temp[0] == '+' || temp[0] == '-' || temp[0] == '*' || temp[0] == '/'){
      pop(&s,&j);
      pop(&s,&k);
      if(temp[0] == '+')
        push(&s,(k + j));
      else if(temp[0] == '-')
        push(&s,(k - j));
      else if(temp[0] == '*')
        push(&s,(k * j));
      else
        push(&s,(k / j));
    }
    else
      push(&s,atoi(temp));
  }
  pop(&s,&k);
  printf("%d\n",k);
}

int main(){
  int x;
  char s[100];
  while( scanf("%s", s) != EOF )
    do_stack(s);
  return 0;
}

