from operator import index
def calculate_function(li):
symbol_li = []
for i in li:
if i == "/" or i == "%" or i == "*":
symbol_li.append(i)
else:
pass
k = 0
m = 0
j = 0
while j < len(symbol_li):
if symbol_li[k] == li[m]:
if symbol_li[k] == "*":
a = int(li[li.index("*")-1]) * int(li[li.index("*")+1])
li.insert(li.index("*")+2,a)
del li[li.index("*")-1:li.index("*")+2]
elif symbol_li[k] == "/":
a = int(li[li.index("/")-1]) / int(li[li.index("/")+1])
li.insert(li.index("/")+2,int(a))
del li[li.index("/")-1:li.index("/")+2]
elif symbol_li[k] == "%":
a = int(li[li.index("%")-1]) % int(li[li.index("%")+1])
li.insert(li.index("%")+2,a)
del li[li.index("%")-1:li.index("%")+2]
m = 0
k += 1
j += 1
else:
m += 1
symbol_li = []
for i in li:
if i == "+" or i == "-":
symbol_li.append(i)
else:
pass
k = 0
m = 0
j = 0
while j < len(symbol_li):
if symbol_li[k] == li[m]:
if symbol_li[k] == "+":
a = int(li[li.index("+")-1]) + int(li[li.index("+")+1])
li.insert(li.index("+")+2,a)
del li[li.index("+")-1:li.index("+")+2]
elif symbol_li[k] == "-":
a = int(li[li.index("-")-1]) - int(li[li.index("-")+1])
li.insert(li.index("-")+2,a)
del li[li.index("-")-1:li.index("-")+2]
m = 0
k += 1
j += 1
else:
m += 1
return li[0]
while 1:
try:
li = input().split()
while "(" in li:
num_list = []
while "(" in num_list or len(num_list) == 0:
k = 0 # "(" 的數量
m = 0 # ")" 的數量
i = 0
while k == 0 or k != m:
if len(num_list) == 0:
if li[i] == "(":
k += 1
elif li[i] == ")":
m += 1
else:
if num_list[i] == "(":
k += 1
elif num_list[i] == ")":
m += 1
i += 1
i -= 1
if len(num_list) == 0 :
num_list = li[li.index("(")+1:i]
else:
num_list = num_list[num_list.index("(")+1:i]
# print("numlist",num_list)
a = len(num_list)
li.insert(li.index(")")+1,calculate_function(num_list)) # li[i] = ")"
del li[li.index(")")-a-1:li.index(")")+1]
print(calculate_function(li))
except:
break