Problem: We have an N×N checkerboard.

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

Each square (i, j) such that i+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) by repeatedly moving to a black square that shares a side with the current square.



Achieve the objective by painting at most 170000 squares black.

Constraints

* 1 \leq N \leq 1,000

Input

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


N


Output

Print the squares to paint in the following format:


K
x_1 y_1
x_2 y_2
:
x_K y_K


This means that a total of K squares are painted black, the i-th of which is (x_i, y_i).

Judging

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

* 0 \leq K \leq 170000
* 0 \leq x_i, y_i \leq N-1
* For each i, x_i + y_i is odd.
* If i \neq j, then (x_i, y_i) \neq (x_j, y_j).
* The condition in the statement is satisfied by painting all specified squares.

Examples

Input

2


Output

1
1 0


Input

4


Output

3
0 1
2 1
2 3

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

class UnionFind{
	private:
		vector<int> parent;
		vector<int> rank;
	public:
		UnionFind(int n)
			:parent(n),rank(n,1){
			for(int i = 0;i < n;i++) parent [i] = i;
		}
		int find(int x){
			if(parent [x] == x) return x;
			return parent [x] = find(parent [x]);
		}
		bool connect(int x,int y){
			x = find(x),y = find(y);
			if(x == y) return false;
			if(rank [x] < rank [y]) swap(x,y);
			if(rank [x] == rank [y]) rank [x]++;
			parent [y] = x;
			return true;
		}
		bool same(int x,int y){
			return find(x) == find(y);
		}
};

int N;
const int dx [] = {0,1,0,-1};
const int dy [] = {-1,0,1,0};

bool in_range(int y,int x)
{
	return y >= 0 && y < N && x >= 0 && x < N;
}

int main()
{
	scanf("%d",&N);

	vector< pair<int,int> > ans;
	UnionFind uf(N * N);
	for(int i = 4;i >= 2;i--){
		FOR(y,0,N){
			for(int x = y % 2 == 0;x < N;x += 2){
				int cnt = 0;
				FOR(j,0,4){
					int y1 = y + dy [j],x1 = x + dx [j];
					if(in_range(y1,x1) == false) continue;
					bool flag = true;
					FOR(k,0,j){
						int y2 = y + dy [k],x2 = x + dx [k];
						flag &= in_range(y2,x2) == false || uf.same(y1 * N + x1,y2 * N + x2) == false;
					}
					cnt += flag;
				}
				if(cnt == i){
					ans.push_back({x,y});
					FOR(j,0,4){
						FOR(k,0,j){
							int y1 = y + dy [j],x1 = x + dx [j],y2 = y + dy [k],x2 = x + dx [k];
							if(in_range(y1,x1) && in_range(y2,x2)){
								uf.connect(y1 * N + x1,y2 * N + x2);
							}
						}
					}
				}
			}
		}
	}

	int K = ans.size();
	printf("%d\n",K);
	FOR(i,0,K){
		printf("%d %d\n",ans [i].first,ans [i].second);
	}

	return 0;
}