sub h{1234567*$_[0]+759213} $h=0;<>; ($q,$L,$R,$K)=glob, '!'eq$q? $h{$h+=$K*($L*h($L)-$R*h($R))}//=$.-1 : print$h{$h}+0,$/ while<>