import re while 1:a=re.sub("(\D)",")\\1",raw_input());exec"print"+"("*a.count(")")+a