Flowerbed Redecoration

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

Joon-Pyo decorated a flowerbed in front of his home. The flowerbed is in the shape of an n×mn \times m grid, and one flower is planted in each cell. There are 26 colors, one corresponding to each uppercase letter from A to Z. Suddenly, he wanted to redecorate the flowerbed.

The flowerbed is too large to adjust the flowers one by one. He rented some equipment that can lift and rotate a square plot of land with a side length of dd. He planned the construction in the following order, expecting the flowerbed to be properly redecorated.

  1. Place the equipment so that exactly the flowers in the first dd rows and the first dd columns are inside.
  2. Rotate the d×dd \times d square inside the equipment 9090^\circ clockwise. If this square contains flowers from the last dd rows and the last dd columns, then the construction is finished. Otherwise, if this square does not contain flowers in the last dd columns, move the equipment xx squares to the right. Otherwise, move the equipment down by yy squares and all the way to the left so it contains flowers from the first dd columns.
  3. Repeat step 2 until construction is finished.

Note that the equipment will never go out of the flowerbed, as xx, yy, and dd are carefully determined before construction begins.

He cannot start construction without knowing the outcome. Write a program that outputs the result.

입력

On the first line, five integers nn, mm, yy, xx, and dd are given. (1n×m1061 \leq n \times m \leq 10^6 , 1yn 1 \leq y \leq n, 1xm1 \leq x \leq m, 1dmin(n,m) 1 \leq d \leq \min(n, m), nd(mody)\boldsymbol{n \equiv d \pmod y}, md(modx)\boldsymbol{m \equiv d \pmod x}). 

Each of the next nn lines contains exactly mm uppercase letters, the current flowerbed.

출력

Output nn lines, each containing mm uppercase letters, the flowerbed after the planned construction.

힌트

In the first example, the flowerbed changes as follows: