시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 0 0 0 0.000%

문제

You are given some domino-like pieces. The following types of pieces are possible:

Note that there are only four types, and you may rotate and reflect any piece for further use. You want to place all the pieces in a matrix of size at most $800 \times 800$ so that you get a single non-self-touching cycle. Formally, this means:

  • All pieces must fully fit in the matrix and be aligned with the grid.
  • No two pieces may overlap.
  • If a certain matrix cell is occupied by a piece, then exactly two of its four neighbours must also be occupied.
  • All occupied cells are connected. In other words, you can travel from any occupied cell to any other occupied cell by only moving to adjacent occupied cells.
  • The "interior" of the cycle must be a single 4-connected area.

입력

The input consists of a single line containing four integers: the number of pieces of each type (in the order they are shown in the image). It is guaranteed that each number is at least 2 and at most 100, and that at least one valid answer exists.

출력

The first line of output must contain two integers $N$ and $M$ ($N, M \le 800$) denoting the number of rows and columns in your matrix. The next lines must describe the matrix in the following format:

  • The matrix must contain integers between 0 and the total number of pieces, inclusive.
  • Cells occupied by the same piece must have the same value.
  • Cells occupied by different pieces must have different values.
  • Cells that are not occupied by any piece must have the value 0.

If there are several valid answers, print any one of them.

예제 입력 1

3 4 3 4

예제 출력 1

11 6
0 1 2 4 4 4
1 1 0 0 0 3
8 0 0 0 3 3
8 0 0 0 9 0
8 0 0 0 9 9
10 0 0 0 0 13
10 0 0 0 0 11
12 0 0 0 0 11
12 0 0 0 0 14
6 0 0 0 0 7
6 5 5 5 7 7

힌트