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

#define MAX 200



    void intialize();
int isEmpty();
int isFull();
void push(int);
int pop();
int s[MAX], top;

int main()
{

    char n[1000000];
    int a,b;

    while (scanf("%s", n) != EOF)
    {
        if(n[0]=='-'){
            a=pop();
            b=pop();
            push(b-a);
        }
        else if(n[0]=='+'){
            a=pop();
            b=pop();
            push(b+a);
        }
        else if(n[0]=='/'){
            a=pop();
            b=pop();
            push(b/a);
        }
        else if(n[0]=='*'){
            a=pop();
            b=pop();
            push(b*a);
        }

        else {
            push(atoi(n));
        }
    }

    printf("%d\n",s[1]);

    return 0;
}

void intialize()
{
    top = 0;
}

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

    else{
         return 0;
    }
       
}

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

    else{
     return 0;
    }
     
}

void push(int x)
{
    if (isFull())
    {
        printf("エラー\n");
    }
    top++;
    s[top] = x;
}

int pop()
{
    if (isEmpty())
    {
        printf("エラー\n");
    }
    top--;
    return s[top + 1];
}
