You must be bored of this Algo Cup and thats why you have opened this challenge problem. So, I wouldn't bore you more.
You need to make a magical square of side n which have digits 1≤m. All digits i which are 1≤i≤m must appear once in the magical square.
A magic square is a square which has equal sum value of all rows and columns i.e if we add all the integers in a row/column it must be equal to sum of integers in any other row/column.
For a given m, you need to construct a magic square such that 1≤n≤103.
For a correct magic square you will get a total score = n4∗SumValueOfARow.
INPUT CONSTRAINTS
1≤m≤1000
INPUT FORMAT
Input contains a single integer m.
OUTPUT
Print a single integer n on the first line of output.After that print n lines each containing n space separated integers, denoting your magic square.
This is a magic square with n=2, for m=2 maybe there exist some better magic square. This sqaure will get a score of 22223