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
#include <stdio.h>

#define BITS (30)
#define N (3*BITS+1)

int main() {
  int k;
  scanf("%d", &k);

  printf("%d\n", N);
  printf("-1 %d\n", (BITS*2+1));
  printf("-1 %d\n", N);
  printf("-1 %d\n", N);

  for(int i = 1; i < BITS-1; i++) {
    printf("%d %d\n", i*2, i*2+1);
    printf("%d %d\n", i*2, i*2+1);
  }
  printf("%d %d\n", BITS*2-2, BITS*2-1);

  for(int i = 0; i < BITS-1; i++) {
    printf("%d %d\n", (k % 2 == 1 ? i*2+2 : -1), BITS*2+2+i);
    k = k / 2;
  }
  printf("%d -1\n", (k == 1 ? BITS*2 : -1));

  printf("-1 -1\n");

  return 0;
}