시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB18131376.471%

## 문제

For the given integer M, build a square table with N rows and N columns (2 ≤ N ≤ 10), filled with decimal digits, with the following restriction: the N-digit numbers formed by the digits in each table row (from left to right), each table column (from top to bottom) and each main diagonal (from top to bottom) must be multiples of M, must not start with the digit 0 and must be unique within the table.

For example, a valid table for M = 2 is

2 3 4
5 6 6
8 2 0


The following tables are not valid for M = 2:

4


because N < 2;

2 0
4 8


because the numbers in the last column and on one of the main diagonals start with the digit 0;

2 3 4
5 8 8
2 0 2


because the number 482 is present twice in the table.

It is not always possible to solve this task. For example, the task is unsolvable for M = 10.

## 입력

The first line contain one value of M.

## 출력

The first line of a file must contain N, the number of rows and columns in the table. The i+1-st line of the file (1 ≤ i ≤ N) must contain the elements of the i-th row of the table as N digits, separated by spaces.

M = 259

## 점수

You will score 0 points for a test case if there is no output for this test case or if any of the conditions given above are not met.

Otherwise your score for the test case is calculated from the formula: N.

## 예제 입력 1

2


## 예제 출력 1

3
2 3 4
5 6 6
8 2 0


## 노트

It is known that there will be at least one solution for each given test input.

Text

## 채점 및 기타 정보

• 6점 이하를 획득해야 를 받는다.
• 예제는 채점하지 않는다.
• 맞힌 사람의 정렬 기준은 점수의 오름차순이다.