sub F{${-($n=pop)}//=($%%$n+$%%(($==$%/($%/$n+1|0))+1))*($n-$=)/2+F($=)}$%=<>;print-F($`-/ /)+F($'),$/for<>