($R,$K)=glob<>; ($H,$W)=glob<>; @_=map[/./g],<>; if($R==0){die; for$y(0..$H-1){ for(1..$K){ for$x(0..$W-1){ print$_[$y][$x]x$K } print$/ } } }elsif($R==90){ for$x(0..$W-1){ for(1..$K){ for$y(reverse 0..$H-1){ print$_[$y][$x]x$K } print$/ } } }elsif($R==180){die; for$y(reverse 0..$H-1){ for(1..$K){ for$x(reverse 0..$W-1){ print$_[$y][$x]x$K } print$/ } } }else{die; for$x(reverse 0..$W-1){ for(1..$K){ for$y(0..$H-1){ print$_[$y][$x]x$K } print$/ } } }