#include<iostream>
using namespace std;

int dots;
unsigned long long Co;
unsigned long long N;

struct tacka{
	int x,y;
};

tacka niz[2000];

char ld[1000000], rd[1000000], cl[1000000];

bool isSafe(int i, int col){

	if (ld[i - col + 1000000] < 3 && rd[i + col] < 3 && cl[i] < 3) return true;
	return false;
}

void Generate(int row, int col){
	if (Co != N && dots <= 2000){
		for (int i = row; i < row + 3; i++)
		if (isSafe(row, col) && Co != N){
			niz[dots].x = row, niz[dots].y = col;
			if (++ld[i - col + 1000000] == 3) Co++;
			if (++rd[i + col] == 3) Co++;
			if(++cl[i] == 3) Co++;
			dots++;
			Generate(row,col+1);
		}
		else Generate(row+1,col+2);
	}
}


int main(){
	ios_base::sync_with_stdio(false);
	
	
	cin >> N;
	Generate(0,0);
	cout << dots << '\n';
	for (int i = 0; i < dots; i++) cout << niz[i].x << ' ' << niz[i].y << '\n';
	
	return 0;
}