Ruby likes binary numbers. She also likes matrices. Therefore, she definitely likes matrices filled with binary numbers!
After thinking about them for a while, she comes up with an interesting question:
Given integers ~N~ and ~M~, find an ~N\times M~ matrix of distinct numbers, where each number in the matrix differs by exactly one bit from its adjacent (up, down, left, right) numbers in the matrix.
Since Ruby knows you like matrices and binary numbers just as much as she does, she's challenged you to solve her problem!
The first and only line of input will contain two space-separated integers ~N~ and ~M~ ~(1 \le N, M \le 1024)~.
An ~N\times M~ matrix that satisfies the properties given above, outputted as ~N~ lines of ~M~ space-separated decimal integers. There may be multiple solutions, in which case you may output any of them.
0 2 10 8 24 1 3 11 9 25 5 7 15 13 29
When seen in binary, it is apparent that each cell differs by only one bit from its adjacent cells. Wow! How cool is that?
00000 00010 01010 01000 11000 00001 00011 01011 01001 11001 00101 00111 01111 01101 11101