@p=qw{ 5000 4887 4999 4902 4997 4910 4998 4925 4994 4935 4993 4938 4987 4954 4990 4959 4989 4978 4766 5207 }; $k=<>; while($k>0){ $s=int sqrt$k; push@a,@p[($i)x$s,($i+1)x$s]; $i+=2; $k-=$s*$s; } print@a."\n@a"