/*#include <stdio.h>
int stack[100000]={},top=-1;
void push(int n)
{
top++;
stack[top]=n;
}
void zero()
{
stack[top]=0;
top--;
}
int pop()
{
if (top!=-1)
{
return stack[top--];
}
}
int main()
{
int i,n,k,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&k);
if(k==0)
zero();
else
push(k);
}
while (top!=-1)
{
sum+=pop();
}
printf("%d",sum);
return 0;
}
#include <stdio.h>
#include <string.h>
char a[101]={},b[101]={};
int ta=-1,tb=-1,stack[102]={},top=-1;
void push(int x)
{
top++;
stack[top]=x;
}
void pop()
{
printf("%d",stack[top]);
top--;
}
int main()
{
int A,B,c=0,num;
scanf("%s %s",a,b);
ta+=strlen(a);
tb+=strlen(b);
while(1)
{
if(ta==-1&&tb==-1&&c==0)
break;
A=0;
B=0;
if(ta>-1)
{
A=a[ta]-'0';
ta--;
}
if(tb>-1)
{
B=b[tb]-'0';
tb--;
}
num=A+B+c;
push(num%10);
c=num/10;
}
while(top>-1)
pop();
return 0;
}
// for(i=0;sta[i]!=NULL;i++)
// {
// stsum[ta-i]=sta[i];
// }
// for(i=0;stb[i]!=NULL;i++)
// {
// stsum[ta-i]+=stb[i]-48;
// if(stsum[ta-i]>57)
// {
// stsum[ta-i]-=10;
// stsum[ta-i-1]++;
// }
// }
// for(i=0;stsum[i]!=NULL;i++)
// printf("%c",stsum[i]);
*/
#include <stdio.h>
#include <string.h>
char pos[201]={};
int stack[100]={},top=-1;
void push(int n)
{
top++;
stack[top]=n;
}
int pop()
{
return stack[top--];
}
int main()
{
int i,k,l;
gets(pos);
for(i=0;pos[i]!=NULL;i++)
{
if(pos[i]>='0'&&pos[i]<='9')
push(pos[i]-'0');
else if(pos[i]==' ')
;
else
{
k=pop();
l=pop();
if(pos[i]=='+')
push(l+k);
if(pos[i]=='-')
push(l-k);
if(pos[i]=='*')
push(l*k);
}
}
printf("%d",stack[0]);
return 0;
}