#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1000005;
const int N = 1005;
ll k;
ll c[N][4];
void ispis(vector<pii> a){
	cout << a.size() << endl;
	for(int i=0;i<a.size();i++)cout << a[i].fi << " " << a[i].se << endl;
}
int slucaj(){
	for(int i=3;i<=N;i++){
		if(c[i][3] <= k && k < c[i+1][3]){
			return i;
		}
	}
}
int slucaj1(int x){
	int rez = 0;
	for(int i=3;i<=N;i++){
		if(c[i][3] <= k-x)rez = i;
		else break;
	}
	return rez;
}
int slucaj3(int z){
	for(int i=3;i<=N;i++){
		if(z == c[i][3])return i;
		if(z < c[i][3])break;
	}
	return 0;
}
int slucaj4(int z){
	int rez = 0;
	for(int i=3;i<=N;i++){
		if(z < c[i][3])break;
		rez = i;
	}
	return rez;
}
int main()
{
	cin >> k;
	c[0][0] = 1;
	for(int i=1;i<=800;i++){
		c[i][0] = c[i][i] = 1;
		for(int j=1;j<=3;j++){
			c[i][j] = c[i-1][j-1] + c[i-1][j];
		}
	}
	int x = slucaj();
	if(k - c[x][3] == 0){
		cout << x << endl;
		for(int i=0;i<x;i++){
			cout << 0 << " " << i << endl;
		}
		return 0;
	}
	int y = slucaj1(c[x][3]);
	vector<pii> v;
	for(int i=0;i<x;i++)v.pb({0,i});
	for(int i=1;i<y;i++)v.pb({i,0});
	if(c[x][3] + c[y][3] == k){
		ispis(v);
		return 0;
	}
	int z = k - c[x][3] - c[y][3];
	int novi = slucaj3(z);
	if(novi){
		for(int i=1;i<y;i++)v.pb({x-1,i});
		ispis(v);
		return 0;
	}
	int stari = slucaj3(z-1);
	if(stari){
		for(int i=1;i<y;i++)v.pb({x-1,i});
 		v.pb({x-2, y-1});
 		ispis(v);
 		return 0;
	}	
	int sta = slucaj4(z);
	cout << sta << endl;
	for(int i=1;i<sta;i++)v.pb({i,y-1});
	z -= c[sta][3];
	cout << z << endl;
	if(z == 1){
		v.pb({1,y});
		z = 0;	
	}
	if(z == 2){
		v.pb({2,y});
		z = 0;
	}
	int zdravko = slucaj4(z);
	zdravko = min(zdravko, y - 1);
	for(int i=1;i<zdravko;i++)v.pb({x-1,i});
	ispis(v);
	return 0;
}
/*
100000000
Pitanje: Kako da z kolinearnih tacaka ispisemo 
*/