#include <stdio.h>
#include <string.h>
int stack[10000]= {},top=0;
int i,sum=0;
void push(int data)
{
stack[++top]=data;
}
int main()
{
char arr[201];
gets(arr);
for(i=0;i<arr[i];i++)
{
if(arr[i] >= '0' && arr[i] <= '9')
{
push(arr[i]-'0');
}
else if(arr[i] == '+')
{
stack[top-1] = stack[top-1] + stack[top];
top--;
push(stack[top]);
}
else if(arr[i] == '-')
{
stack[top-1] = stack[top-1] - stack[top];
top--;
push(stack[top]);
}
else if(arr[i] == '*')
{
stack[top-1] = stack[top-1] * stack[top];
top--;
push(stack[top]);
}
}
printf("%d",stack[0]);
}



