/*
 *  author:    milos
 *  created:   25.01.2020 18:02:59
**/
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 18;
int main()
{
	int k;
	cin>>k;
	int a[MAXN];
	int i=1,j=3;
	a[0]=1;
	while(j<=100000000)
	{
		a[i]=j+1;
		i++;
		j*=3;
	} 
	i=0;
	j=0;
	int r=100;
	vector<pair<int,int> > v;
	while(k>0)
	{
		for(int l=16;l>=0;l--)
		{
			if(k>=a[l])
			{
				k-=a[l];
				for(int t=0;t<l+3;t++)
				{
     					v.push_back(make_pair(i+t,j));
				}
				break;
			}
		}
		i=r;
		if(j%2==0)
		{
			r+=167;
		}
		else
		{
			r+=165;
		}       	
		j+=r-(int)v.size();       	
		
	}
	cout<<v.size()<<endl;
	for(i=0;i<(int)v.size();i++)
		cout<<v[i].first<<" "<<v[i].second<<endl;
}