#include <stdio.h>
#include <stdlib.h>
int main()
{
char *str;
int n = 0, pri_span = 0, pri_final = 0;
int num_x = 0, *cal, cal_x = 0;
long long *num;
str = (char *)calloc(200, sizeof(char));
num = (long long *)calloc(100, sizeof(long long));
cal = (int *)calloc(100, sizeof(int));
scanf("%[^\n]c", str);
while (*(str + n) != 0)
{
if (*(str + n) <= '9' && *(str + n) >= '0')
{
int k = 0;
while (str[n + k] <= '9' && str[n + k] >= '0')
k++;
if (k == 1)
*(num + num_x) = (*(str + n) - 48) * 1;
else if (k == 2)
*(num + num_x) = (*(str + n) - 48) * 10 + (*(str + n + 1) - 48) * 1;
else if (k == 3)
*(num + num_x) = (*(str + n) - 48) * 100 + (*(str + n + 1) - 48) * 10 + (*(str + n + 2) - 48) * 1;
n = n + k - 1;
num_x = num_x + 1;
}
else if (*(str + n) == '(')
{
pri_span = pri_span + 5;
}
else if (*(str + n) == ')')
{
pri_span = pri_span - 5;
}
else if (*(str + n) == ' ')
{
}
else
{
if (*(str + n) == '*')
{
pri_final = pri_span + 5;
}
else if (*(str + n) == '/')
{
pri_final = pri_span + 4;
}
else if (*(str + n) == '%')
{
pri_final = pri_span + 3;
}
else if (*(str + n) == '+')
{
pri_final = pri_span + 2;
}
else if (*(str + n) == '-')
{
pri_final = pri_span + 1;
}
*(cal + cal_x) = pri_final;
cal_x++;
}
n++;
}
while (cal_x)
{
for (int i = 0; i <= cal_x; i++)
{
if (*(cal + i) > *(cal + i + 1))
{
if (*(cal + i) % 5 == 0)
{
*(num + i) = (*(num + i)) * (*(num + i + 1));
}
else if (*(cal + i) % 5 == 4)
{
*(num + i) = (*(num + i)) / (*(num + i + 1));
}
else if (*(cal + i) % 5 == 3)
{
*(num + i) = (*(num + i)) % (*(num + i + 1));
}
else if (*(cal + i) % 5 == 2)
{
*(num + i) = (*(num + i)) + (*(num + i + 1));
}
else if (*(cal + i) % 5 == 1)
{
*(num + i) = (*(num + i)) - (*(num + i + 1));
}
for (int j = i; j <= cal_x; j++)
{
*(cal + j) = *(cal + j + 1);
}
for (int j = i + 1; j <= num_x; j++)
{
*(num + j) = *(num + j + 1);
}
cal_x--;
num_x--;
}
}
}
printf("%d\n", *(num));
return 0;
}