sub w{open(X,">",@_);select(X);} sub r{"dd if=$_[0]".($n%3)." bs=".($n*7)." count=1 status=none;";} CHECK{ if($^C){ @0=map{$_*9+1,$_*9+2,$_*9+9}0..199999; @1=map{$_*9+6,$_*9+8,$_*9+7}0..199999; @2=map{$_*9+3,$_*9+4,$_*9+5}0..199999; w(a0);printf " %6d",$_ for@0; w(b0);printf " %6d",$_ for@1; w(c0);printf " %6d",$_ for@2; w(a2);printf " %6d",$_ for 1,4,map$_+6,@0; w(b2);printf " %6d",$_ for 3,6,map$_+6,@1; w(c2);printf " %6d",$_ for 5,2,map$_+6,@2; w(a1);printf " %6d",$_ for 1,2,4,11,map$_+12,@0; w(b1);printf " %6d",$_ for 7,9,10,12,map$_+12,@1; w(c1);printf " %6d",$_ for 8,5,6,3,map$_+12,@2; } } $n=<>; $n<2?print-1:system(r(a).r(b).r(c))