#include <stdio.h>
#include <stdlib.h>
int main()
{
int S[100];
int i;
int z,ans=0;
char a[20];
int s_top =0;
for(i=0;i<200;i++)
{
z=scanf("%s",a);
if(z==EOF) break;
if (a[0]== '+' ) 
{
S[s_top-2]= S[s_top-2]+S[s_top-1];
//printf("tasu   %d",S[s_top-2]);
s_top--;
}
else if (a[0]== '-' )
{
S[s_top-2]=S[s_top-2]-S[s_top-1];
//printf("mainasu   %d",S[s_top-2]);
s_top--;
}
else if (a[0]== '*' ) 
{
S[s_top-2] = S[s_top-2]*S[s_top-1];
//printf("kakezan   %d",S[s_top-2]);
 s_top--;
}
else if (a[0]== '/' ) 
{
	S[s_top-2]=S[s_top-2]/S[s_top-1];
s_top--;
}
else
{
S[s_top]=atoi(a);
s_top++;
}
}  
printf("%d\n",S[s_top-1]);
return 0;
}