1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#define pb push_back
#define mp make_pair
#define fi first
#define se second 
#define all(...) begin(__VA_ARGS__) , end(__VA_ARGS__)
#define boost {ios_base::sync_with_stdio(false); cin.tie(); cout.tie();}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector <int> vi;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
constexpr ll nax = 2e5+6969, INF = 2e9+6969;

ll k,f[100];
int ans[2][300];
map <ll,int> cnt;

void count(ll x)
{
	for(int i=50;i>=1;--i) 
	{
		if(x >= f[i])
		{
			x -= f[i];
			cnt[i]++;
		}
	}
	if(x == 0) return;
	count(x);
}
void make(int a, int b)
{
	if(ans[0][a] == 0) ans[0][a] = b;
	else  ans[1][a] = b;
}

int main()
{
	f[0] = f[1] = 1;
	for(int i=2;i<=50;++i) f[i] = f[i-1] + f[i-2];
	cin >> k;
	count(k);
	make(1,2);
	int N = 50;
	//  #warning change N
	for(int i=3;i<=N;++i) make(i-2, i);
	int cur = N+1;
	queue <int> s;
	for(int i=2;i<N;++i) make(i,i+1);
	for(auto e: cnt)
	{
		make(e.fi+1, cur);
		make(cur, e.fi+2);
		s.push(cur);
		cur++;
	}
	while(!s.empty())
	{
		int a = s.front();
		s.pop();
		if(s.empty()) break;
		int b = s.front();
		s.pop();
		make(a,cur);
		make(b,cur);
		s.push(cur);
		cur++;
	}
	printf("%d\n", cur - 1);
	for(int i=1;i<cur;i++)
	{
		for(int j=0;j<2;++j) printf("%d ", (ans[j][i] == 0 ? -1 : ans[j][i]));
		puts("");
	}
	return 0;
}