Chess Puzzle
시간 제한2초메모리 제한256 MB
4행 n열 체스판에서 나이트가 [1,1]에서 출발해 같은 칸으로 돌아오는 닫힌 경로를 만들되, 되풀이 없이 최대한 많은 칸을 방문하는 경로를 찾아 출력한다.
문제
There is a chessboard having four rows and columns. All rows are numbered with the sequential integers from to , and, similarly, all the columns are numbered with sequential integers from to . Each square of the chessboard can be described with its coordinates , where is its row number and --- its column number.
Also, there is a chess knight standing at the square . The example of 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 . Knight should visit each square (except for the square ) 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 () --- the number of columns on the chessboard.
출력
The first line of output should contain the maximum number of squares that a knight can visit, traversing every square of the chessboard only once (except for the square ).
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 . Coordinates should be printed with no line breaks and should be separated by the only space.