time limit per test: 0.5
memory limit per test: 65536
It is necessary to arrange numbers from 0 to 2^(N+M)-1 in the matrix with 2^N rows and 2^M columns. Moreover, numbers occupying two adjacent cells must differ only in single bit in binary notation. Cells are adjacent if they have common side. Matrix is cyclic, i.e. for each row the leftmost and rightmost matrix cells are considered to be adjacent (the topmost and the bottommost matrix cells are also adjacent).
The first line of input contains two integers N and M (0<N,M; N+M<=20).
Output file must contain the required matrix in a form of 2^N lines of 2^M integers each.
|Resource:||Petrozavodsk Summer Training Sessions 2004
|Date:||August 25, 2004
|Server time: 2016-07-02 06:54:39||Online Contester Team © 2002 - 2016. All rights reserved.|