#include using namespace std; using ll = long long; //using VV = vector >; using VV = vector >; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b A){ ll L = A.size(); FOR(i, 0, L){ //if(i) cout << ' '; cout << A[i]; } cout << endl; } // 時計回りに回転 VV rot90(VV mat){ ll H = mat.size(); ll W = mat[0].size(); ll new_W = H; ll new_H = W; VV M(new_H); FOR(y, 0, new_H){ for(ll i=H-1; i>=0; i--){ char c = mat[i][y]; M[y].push_back(c); } } return M; } VV expand(VV m, ll scale){ ll H = m.size(); ll W = m[0].size(); ll new_H = H * scale; ll new_W = W * scale; VV M(new_H); FOR(y, 0, new_H){ FOR(x, 0, new_W){ char c = m[y/scale][x/scale]; M[y].push_back(c); } } return M; } void print_mat(VV x){ ll H = x.size(); FOR(i, 0, H){ vprint(x[i]); } } int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll R, K, H, W; cin >> R >> K >> H >> W; VV mat(H); FOR(y, 0, H){ string s; cin >> s; mat[y].resize(s.size()); FOR(x, 0, W){ mat[y][x] = s[x]; } } ll rot_num = R / 90; FOR(i, 0, rot_num){ mat = rot90(mat); } mat = expand(mat, K); print_mat(mat); return 0; }