[//]: # 参照一位大神写的代码,自己重写一遍,值得再次复习
nums, ops = [], []
priority = {
'+': 0,
'-': 0,
'*': 1,
'/': 1
}
def eval():
n1 = nums.pop()
n2 = nums.pop()
ans = 0
op = ops.pop()
if op == '-':
ans = n2 - n1
elif op == '+':
ans = n1 + n2
elif op == '*':
ans = n1 * n2
elif op == '/':
ans = int(n2 / n1)
nums.append(ans)
if __name__ == '__main__':
s = input()
i = 0
while i < len(s):
c = s[i]
if s[i].isdigit():
_n = 0
while i < len(s) and s[i].isdigit():
_n = _n * 10 + int(s[i])
i += 1
nums.append(_n)
continue
elif c == '(':
ops.append(c)
elif c == ')':
while ops[-1] != '(':
eval()
ops.pop()
else:
while ops and ops[-1] != '(' and priority[ops[-1]] >= priority[c]:
eval()
ops.append(c)
i += 1
while ops:
eval()
print(nums[-1])