#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) #define CLR(mat) memset(mat, 0, sizeof(mat)) typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int R, K; cin >> R >> K; int H, W; cin >> H >> W; vector > s(H, vector(W)); FOR(i,0,H) FOR(j,0,W) cin >> s[i][j]; R /= 90; FOR(i,0,R) { int h = s.size(); int w = s[0].size(); vector > t(w, vector(h)); FOR(i,0,h) { FOR(j,0,w) { t[j][h - i - 1] = s[i][j]; } } s = t; } FOR(i,0,s.size()) { FOR(k,0,K) { FOR(j,0,s[0].size()) { FOR(l,0,K) { cout << s[i][j]; } } cout << endl; } } return 0; }