import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def from_read(dtype=np.int64): return np.fromstring(read().decode(), dtype=dtype, sep=' ') def from_readline(dtype=np.int64): return np.fromstring(readline().decode(), dtype=dtype, sep=' ') def solve_max(): THRESH = 35242 MAX = 1000 XY, n = np.empty((10**6, 2), np.int64), 0 for x in range(1, MAX + 1): for y in range(0, MAX + 1): if abs(x) + abs(y) > MAX: continue if x == y == 0: continue if np.gcd(x, y) > 1: continue XY[n], n = (x, y), n + 1 XY[n], n = (-y, x), n + 1 XY = XY[:n] Z = np.abs(XY).sum(axis=1) XY = XY[Z < MAX] XY = np.concatenate((XY, -XY), axis=0) sort_key = np.arctan2(XY[:,1], XY[:,0]) argsort = np.argsort(sort_key) XY = XY[argsort] points = np.cumsum(XY, axis=0) points[:,0] -= points[:,0].min() points[:,1] -= points[:,1].min() return points def main(N): points = solve_max().ravel().tolist() print(N) print(" ".join(map(str, points))) main(10 ** 6)