#!/usr/bin/env python3
import sys
import random

n = int(sys.argv[1])
random.seed(int(sys.argv[2]))

a = random.randint(1,n//3)
b = n - random.randint(1,n//3)
print(n)
for i in range(a):
    print(i,2*a)
for i in range(a,b):
    print(i,2*i)
for i in range(b,n):
    print(i,2*b)

