atcoder#RELAYJ. 連結チェスボード

連結チェスボード

Score : 100100 points

Problem Statement

We have an N×NN \times N checkerboard.

From the square at the upper left corner, a square that is ii squares to the right and jj squares below is denoted as (i,j)(i, j). Particularly, the square at the upper left corner is denoted as (0,0)(0, 0).

Each square (i,j)(i, j) such that i+ji+j is even, is colored black, and the other squares are colored white.

We will satisfy the following condition by painting some of the white squares:

  • Any black square can be reached from square (0,0)(0, 0) by repeatedly moving to a black square that shares a side with the current square.

Achieve the objective by painting at most 170000170000 squares black.

Constraints

  • 1N1,0001 \leq N \leq 1,000

Input

The input is given from Standard Input in the following format:

NN

Output

Print the squares to paint in the following format:

KK

x1x_1 y1y_1

x2x_2 y2y_2

:

xKx_K yKy_K

This means that a total of KK squares are painted black, the ii-th of which is (xi,yi)(x_i, y_i).

Judging

The output is considered correct only if all of the following conditions are satisfied:

  • 0K1700000 \leq K \leq 170000
  • 0xi,yiN10 \leq x_i, y_i \leq N-1
  • For each ii, xi+yix_i + y_i is odd.
  • If iji \neq j, then (xi,yi)(xj,yj)(x_i, y_i) \neq (x_j, y_j).
  • The condition in the statement is satisfied by painting all specified squares.
2
1
1 0
4
3
0 1
2 1
2 3