def F(u):z=lambda v:F('(%s %s)'%(u,v.s));z.s=u;return z while 1:f=F('f');print input().s