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

#define N 100
#define STACK_MAX 100
#define NUMBER '0'
#define BUFSIZE 100
#define MAXVAL 100

int getop(char *);
int getch(void);
void ungetch(int);
void push(int);
int pop(void);

char *stack[STACK_MAX];
int sp=0;
int val[MAXVAL];

int main()
{
  char data[N];
  int i,x,y,c;

  for(i=0;data[i] != '\0';i++){
    scanf("%s",data);
  }
  while((c=getop(data)) != EOF) {
    switch(data[c]){
    case '+':
      x = pop();
      y = pop();
      push(x+y);
      break;
    case '-':
      x = pop();
      y = pop();
      push(x-y);
      break;
    case '*':
      x = pop();
      y = pop();
      push(x*y);
      break;
    case '\n':
      printf("%d\n", pop());
      break;
    default :
      push(data[i]);
      break;
    }
  }

  return 0;

}
int getop(char *data)
{
    int i, c;

    while ((data[0] = c = getch()) == ' ' || c == '\t')
        ;  
    data[1] = '\0';
    if(!isdigit(c) && c != '.')
        return c;                    
    i = 0;
    if (isdigit(c))
        while (isdigit(data[++i] = c = getch()))
            ;                        
    if (c == '.')
        while (isdigit(data[++i] = c = getch()))
            ;                        
    data[i] = '\0';
    if (c != EOF)
        ungetch(c);                   
    return NUMBER;
}

char buf[BUFSIZE];
int bufp = 0;

int getch(void)
{
    return (bufp > 0) ? buf[--bufp] : getchar();
}

void ungetch(int c)
{
    if (bufp >= BUFSIZE)
        printf("ungetch: too many characters\n");
    else
        buf[bufp++] = c;
}


void push(int f)
{
    if (sp < MAXVAL)
        val[sp++] = f;
    else
        printf("error: stack full, can't push %g\n", f);
}

int pop(void)
{
    if (sp > 0)
        return val[--sp];
    else {
        printf("error: stack empty\n");
        return 0;
    }
}