#!/usr/bin/python
import sys
import random

if len(sys.argv) >= 3:
    t = int(sys.argv[1])
    n = int(sys.argv[2])
else:
    t = 1
    n = random.randint(3, 240)

n -= n % 8
print(n)
lst = []

def check(x, y):
    for i in lst:
	for j in lst:
	    if i != j and (i[0] - x) * (j[1] - y) == (i[1] - y) * (j[0] - x):
		return False
    return True

if t == 3:
    n //= 2

if t > 1:
    m = n // 4
    acc = 0
    x0 = m + 4
    y0 = m * m + m * 2
    for i in range(1, m + 1):
        acc += i
        lst += [(15 * (x0 + i), acc)]
        lst += [(15 * (x0 - i), acc)]
        lst += [(15 * (x0 + i), y0 - acc)]
        lst += [(15 * (x0 - i), y0 - acc)]

if t == 3:
    n *= 2

if t != 2:
    while len(lst) < n:
        x = random.randint(0, 1023)
        y = random.randint(0, 1023)
        if check(x, y):
            lst += [(x, y)]

for x, y in lst:
    print x, y
