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;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod =1000000009;





int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;

	set<pair<int, int>> s;


	if (n < 400) {
		REP(i, n) {
			REP(j, n) {
				if ((i+j) % 2==1) {
					s.insert({ i,j });
				}
			}
		}
		cout << s.size() << endl;
		for (auto i : s) {
			cout << i.first << ' ' << i.second << endl;
		}
		return 0;
	}


	for (int i = 1; i < n; i += 3) {
		REP(j, n) {
			if ((i + j) % 2 == 1) {
				s.insert({ i,j });
			}
		}
	}

	REP(i, n) {
		if (i % 2 == 1 && i % 3 != 1) {
			s.insert({ i,0 });
		}
	}

	REP(i, n) {
		if ((n - 1 + i) % 2 == 1) {
			s.insert({ n - 1,i });
			s.insert({ i,n-1 });
		}
		if (i % 2 == 1) {
			s.insert({ i,0 });
			s.insert({ 0,i });
		}
	}

	cout << s.size() << endl;

	for (auto i : s) {
		cout << i.first << ' ' << i.second << endl;
	}

	return 0;
}