#P12164. 2025 Pattern Drawing

    ID: 14266 Type: Default 1000ms 256MiB

2025 Pattern Drawing

2025 Pattern Drawing

Little Blue wants to draw a 2025 Pattern shape. The shape is a rectangle of height h and width w. The pattern is generated by repeating the string 2025 infinitely, and each subsequent row is produced by cyclically shifting the previous row by one character to the left.

For example, when h = 5 and w = 10, the output is:

2025202520
0252025202
2520252025
5202520252
2025202520

Note that the shift is cyclic with period 4 (i.e. the length of 2025). In other words, for the row indexed i (0-indexed), you should start printing from the character at index i mod 4 in the repeated pattern and output exactly w characters.

inputFormat

The input consists of a single line containing two space separated integers h and w where:

  • h (1 ≤ h ≤ 1000) is the height of the rectangle.
  • w (1 ≤ w ≤ 1000) is the width of the rectangle.

outputFormat

Output the required h x w pattern, where each of the h lines contains exactly w characters, generated as described above.

sample

5 10
2025202520

0252025202 2520252025 5202520252 2025202520

</p>