<>; for(<>){ ($n,$m)=glob; $n%=$m*2; if($n<$m){ $z=9x$n||0; }else{ $z=9x$m.0 x($n-$m); } print$z,$/; }