import re
INPUT = input(">> ")#"(5-2)/5"
TOKENS = re.compile("(\+|\-|\*|/|\(|\))").split(INPUT)
EXPR = list(filter(None,TOKENS))
def get(): return EXPR[0] if EXPR else False
def ch(p, c: str) -> bool: return [True, EXPR.pop(0)][0] if p == c else False
def un() -> float:
if(ch(get(),'(')):
ex = eval()
if(not ch(get(),')')): print("expected ')'\n")
return ex
else:
res = EXPR.pop(0)
return float(res)
def muls() -> float:
ex = un()
while(True):
if(ch(get(),"*")): ex *= un()
elif(ch(get(),"/")): ex /= un()
else: return ex
def eval() -> float:
ex = muls()
while(True):
if(ch(get(), "+")): ex += muls()
elif(ch(get(), "-")): ex -= muls()
else: return ex
if __name__ == "__main__":
print(f"{''.join(EXPR)} = {eval()}")