Chess Puzzle

아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

There is a chessboard having four rows and nn columns. All rows are numbered with the sequential integers from 11 to 44, and, similarly, all the columns are numbered with sequential integers from 11 to nn. Each square of the chessboard can be described with its coordinates \[r,c]\[r, c], where rr is its row number and cc --- its column number.

Also, there is a chess knight standing at the square \[1,1]\[1, 1]. The example of 4×n4 \times n chessboard with a knight on it is shown below:

Knight's target is to make a traversal, that starts and ends at the same square \[1,1]\[1, 1]. Knight should visit each square (except for the square \[1,1]\[1, 1]) only once during its traversal.

Chess knight can move from some square to a square that is two squares horizontally and one square vertically, or two squares vertically and one square horizontally. The complete move therefore looks like the letter L.

You are to write a program that will find the maximum number of different visited squares of the knight's traversal and this traversal itself.

입력

The only line of input contains the only integer nn (2n1042 \leq n \leq 10^{4}) --- the number of columns on the chessboard.

출력

The first line of output should contain the maximum number of squares mm that a knight can visit, traversing every square of the chessboard only once (except for the square \[1,1]\[1, 1]).

The second line of output should contain the coordinates of the squares to visit in order of the optimum traversal. All the coordinates should be printed as r_1c_1r_2c_2r_mc_mr_1c_1r\_{1} c\_{1} r\_{2} c\_{2} \ldots r\_{m} c\_{m} r\_{1} c\_{1}. Coordinates should be printed with no line breaks and should be separated by the only space.