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
82
83
84
85
#include <bits/stdc++.h>
using namespace std;

long long k;
long long T[60];
bool Fib[60];
int x;
vector<int>G[100];

int main()
{
    cin>>k;
    T[0]=1;
    T[1]=1;
    for (int i=2; i<60; ++i)
        T[i]=T[i-1]+T[i-2];

    for (int i=59; i>=0; --i)
        if (k>=T[i]){
            Fib[i]=true;
            k-=T[i];
        }

 /*   for (int i=10; i>=0; --i){
        if (Fib[i])
            cout<<1;
        else cout<<0;
    }

    cout<<"\n";
*/
    for (int i=0; i<60; ++i)
        if (Fib[i])
            x=i;

    ++x;

    G[1].push_back(0);
    for (int i=2; i<x; ++i){
        G[i].push_back(i-1);
        G[i].push_back(i-2);
    }

    Fib[x-1]=false;

/*     for (int i=10; i>=0; --i){
        if (Fib[i])
            cout<<1;
        else cout<<0;
    }
    cout<<"\n";

    for (int i=0; i<=x; ++i){
        if (G[i].size()==0)
            cout<<-1<<" "<<-1<<"\n";
        else if (G[i].size()==1)
            cout<<-1<<" "<<G[i][0]+1<<"\n";
        else
            cout<<G[i][0]+1<<" "<<G[i][1]+1<<"\n";
    }
*/
    int j=x;

    for (int i=x; i>=0; --i){
        if (Fib[i]){
            G[j].push_back(i);
            G[j].push_back(j-1);
            ++j;
        }
    }

    cout<<j<<"\n";
    for (int i=j-1; i>=0; --i){
        if (G[i].size()==0)
            cout<<-1<<" "<<-1<<"\n";
        else if (G[i].size()==1)
            cout<<-1<<" "<<j-G[i][0]<<"\n";
        else
            cout<<j-G[i][0]<<" "<<j-G[i][1]<<"\n";
    }



    return 0;
}