<>=~$";$k=$';<>=~/(\((?1)*\))(?{$b[$b[$+[1]]=$-[1]+1]=$+[1]})^/;print$b[$k]