sub f{(local$x=++$k+$x)<$N&&&f;$\+=$N/$x|0,$N%=$x}$N=<>;f;print