while True:
    try:
        a = input()
    except:
        break
    else:
        aa = a.replace("[", "(").replace("]", ')').replace("{", "(").replace("}", ")")
        print(int(eval(aa)))