#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define n0 30
int sl[n0+1];
char s2[n0+1];
int t1,t2;
void calcu()
{
int xl,x2,x;
char p;
p=s2[t2--];
x2=sl[t1--];
xl=sl[t1--];
switch(p)
{
case'+':
x=xl+x2;break;
case'-':
x=xl-x2;break;
case'*':
x=xl*x2;break;
case'£¯':
x=xl/x2;
}
sl[++t1]=x;
}
void calculator();
int main()
{
calculator();
return 0;
}
void calculator()
{
char c;
int v;
t1=t2=0;
scanf("%c",&c);
while(c!=';')
switch(c)
{
case'+':
case'-':
while(t2&&(s2[t2]!='('))
calcu();
s2[++t2]=c;
scanf("%c",&c);
break;
case'*':
case'£¯':
if(t2&&((s2[t2]=='*')||(s2[t2]=='£¯')))
calcu();
s2[++t2]=c;
scanf("%c",&c);
break;
case '(':
s2[++t2]=c;
scanf("%c",&c);
break;
case ')':
while(s2[t2]!='(')
calcu();
t2--;
scanf("%c",&c);
break;
default:
v=0;
do
{
v=10*v+c-'0';
scanf("%c",&c);
}while((c>='0')&&(c<='9'));
sl[++t1]=v;
};
while(t2)
calcu();
printf("%d",sl[t1]);
}