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

pair<int, int> tab[109];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	for(int i=0;i<109;i++) 
		tab[i] = {-1, -1};
	int ile = 30;
	for(int i=1;i<=(ile-1)*3+1;i++) {
		if(i%3==1) {
			tab[i] = {i+1, i+2};
		} else if(i%3==2) {
			tab[i] = {i+2, -1};
		} else {
			tab[i] = {i+1, -1};
		}
	}
	int x;
	cin >> x;
	for(int i=0;i<32;i++) {
		if(x&(1<<i)) {
			tab[3*i+2].second = ile*3+1;
		}
	}
	tab[ile*3+1] = {-1, -1};
	cout << ile*3+1 << "\n";
	for(int i=1;i<=ile*3+1;i++) {
		cout << tab[i].first << " " << tab[i].second << "\n";
	}
}