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

typedef long ELEM;      //???????????????????´???????
#define STACK_SIZE 100  //?????????????????§??????

void error(char *s);
void init();
void push(ELEM x);
ELEM pop();
int empty();

ELEM stack[STACK_SIZE]; //?????????????????????
int n;                  //???????????????????????????

int main(void)
{
    int c;
    long x, a, b;

    init();
    while ((c = getchar()) != EOF) {
        if (isdigit(c)) {
            ungetc(c, stdin);
            scanf("%ld", &x);
            push(x);
        } else {
            switch (c) {
                case '+':
                    b = pop();
                    a = pop();
                    push(a+b);
                    break;
                case '-':
                    b = pop();
                    a = pop();
                    push(a-b);
                    break;
                case '*':
                    b = pop();
                    a = pop();
                    push(a*b);
                    break;
                case '/':
                    b = pop();
                    a = pop();
                    push(a/b);
                    break;
                case '\n':
                    if (! empty()) {
                        //printf("?????????%ld??§??????\n", pop());
                        printf("%ld\n", pop());
                        return 0;
                    }
                    init();
                    break;
                case ' ':
                case '\t':
                    break;
                default:
                    printf("?????£??????????????????????????????\n");
                    printf("??\?????????????????????????????????\n");
                    while ((c=getchar()) != EOF && c != '\n')
                        ;
                    break;
            }
        }
    }
}

void error(char *s)
{
    fprintf(stderr, s);
    exit(1);
}

void init()
{
    n = 0;
}

void push(ELEM x)
{
    if (n >= STACK_SIZE)
        error("stack overflow\n");
    stack[n++] = x;
}

ELEM pop()
{
    if (n <= 0)
        error("stack underflow\n");
    return stack[--n];
}

int empty()
{
    return n==0;
}