/*
int main()
{
char a[50001];
int b;
int i,c=0;
scanf("%s",a);
b=strlen(a);
for(i=0; i<b; i++)
{
if(a[i]=='(')
{
c++;
}
else if(a[i]==')')
{
c--;
if(c<0)
{
printf("bad");
return 0;
}
}
}
if(c!=0)
{
printf("bad");
}
else
{
printf("good");
}
}
*/
/*
#define SIZE 101
int stack[SIZE];
int top=-1;
push(int data)
{
if(top==SIZE-1)
return ;
stack[++top]=data;
}
int main()
{
int c,d,i,e=0,f;
char a[101]= {0},b[101]= {0};
scanf("%s %s",a,b);
c=strlen(a);
d=strlen(b);
if(c>d)
{
for(i=c-1; i>=0; i--)
{
f=i-c+d;
if(f<0)
{
f=0;
b[f]='0';
}
push((a[i]+b[f]-96+e)%10);
e=(a[i]+b[f]+e-96)/10;
}
}
else
{
for(i=d-1; i>=0; i--)
{
f=i-d+c;
if(f<0)
{
f=0;
a[f]='0';
}
push((a[f]+b[i]-96+e)%10);
e=(a[f]+b[i]+e-96)/10;
}
}
if(e!=0) push(e);
for(i=top; i>=0; i--)
{
printf("%d",stack[i]);
}
}
*/
#define SIZE 201
int stack[SIZE];
int top=-1;
int pop()
{
if(top==-1)
return -1;
return stack[top--];
}
push(int data)
{
if(top==SIZE-1)
return ;
stack[++top]=data;
}
void view()
{
printf("stack : ");
for(int i=0;i<=top;i++)
printf("%d ",stack[i]);
printf("------\n");
}
int main()
{
char a[201];
int i,l,n,m;
gets(a);
l=strlen(a);
for(i=0; i<l; i++)
{
if(a[i]=='+')
{
n=pop();
m=pop();
push(m+n);
}
if(a[i]=='-')
{
n=pop();
m=pop();
push(m-n);
}
if(a[i]=='*')
{
n=pop();
m=pop();
push(m*n);
}
if('0'<=a[i]&& a[i]<='9')
{
push(a[i]-'0');
}
//view();
}
printf("\nresult : %d",pop());
return 0;
}