Jumbo Takahashi will play golf on an infinite two-dimensional grid.
The ball is initially at the origin (0, 0), and the goal is a grid point (a point with integer coordinates) (X, Y). In one stroke, Jumbo Takahashi can perform the following operation:
 - Choose a grid point whose Manhattan distance from the current position of the ball is K, and send the ball to that point.
The game is finished when the ball reaches the goal, and the score will be the number of strokes so far. Jumbo Takahashi wants to finish the game with the lowest score possible.
Determine if the game can be finished. If the answer is yes, find one way to bring the ball to the goal with the lowest score possible.
What is Manhattan distance?
The Manhattan distance between two points (x_1, y_1) and (x_2, y_2) is defined as |x_1-x_2|+|y_1-y_2|.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq K \leq 10^9
 - -10^5 \leq X, Y \leq 10^5
 - (X, Y) \neq (0, 0)

-----Input-----
Input is given from Standard Input in the following format:
K
X Y

-----Output-----
If the game cannot be finished, print -1.
If the game can be finished, print one way to bring the ball to the destination with the lowest score possible, in the following format:
s
x_1 y_1
x_2 y_2
.
.
.
x_s y_s

Here, s is the lowest score possible, and (x_i, y_i) is the position of the ball just after the i-th stroke.

-----Sample Input-----
11
-1 2

-----Sample Output-----
3
7 4
2 10
-1 2

 - The Manhattan distance between (0, 0) and (7, 4) is |0-7|+|0-4|=11.
 - The Manhattan distance between (7, 4) and (2, 10) is |7-2|+|4-10|=11.
 - The Manhattan distance between (2, 10) and (-1, 2) is |2-(-1)|+|10-2|=11.
Thus, this play is valid.
Also, there is no way to finish the game with less than three strokes.

Difficulty: MEDIUM_HARD

Starter code:

Solutions:
k = int(input())
(x, y) = list(map(int, input().split()))
ans = []
if k % 2 == 0:
	if (x + y) % 2 == 1:
		print(-1)
		return
x_reverse = False
y_reverse = False
if x < 0:
	x *= -1
	x_reverse = True
if y < 0:
	y *= -1
	y_reverse = True

def app(a, b):
	nonlocal ans
	if x_reverse:
		a *= -1
	if y_reverse:
		b *= -1
	ans.append((a, b))
nowx = 0
nowy = 0
while abs(x - nowx) + abs(y - nowy) >= 2 * k:
	if abs(x - nowx) > k:
		nowx += k
	else:
		nowy += k
	app(nowx, nowy)

def ok():
	app(x, y)
	print(len(ans))
	for (a, b) in ans:
		print((a, b))
	return
rest = abs(x - nowx) + abs(y - nowy)
if rest == k:
	ok()
if rest % 2 == 0:
	delta = 2 * k - rest
	assert delta % 2 == 0
	if abs(x - nowx) < abs(y - nowy):
		temp = abs(x - nowx) + delta // 2
		nowx += temp
		nowy += k - temp
	else:
		temp = abs(y - nowy) + delta // 2
		nowy += temp
		nowx += k - temp
	app(nowx, nowy)
	ok()
if abs(x - nowx) < abs(y - nowy):
	nowx += k
	app(nowx, nowy)
else:
	nowy += k
	app(nowx, nowy)
x_delta = x - nowx
x_pm = x_delta // abs(x_delta)
y_delta = y - nowy
y_pm = y_delta // abs(y_delta)
if abs(x_delta) < abs(y_delta):
	delta = 2 * k - (abs(x_delta) + abs(y_delta))
	temp = abs(x - nowx) + delta // 2
	nowx += x_pm * temp
	nowy += y_pm * (k - temp)
	app(nowx, nowy)
	ok()
else:
	delta = 2 * k - (abs(x_delta) + abs(y_delta))
	temp = abs(y - nowy) + delta // 2
	nowy += y_pm * temp
	nowx += x_pm * (k - temp)
	app(nowx, nowy)
	ok()


import sys
K = int(input())
(X, Y) = list(map(int, input().split()))
mx = 1 if X >= 0 else -1
my = 1 if Y >= 0 else -1
(X, Y) = (abs(X), abs(Y))
isSwaped = False
if X < Y:
	(X, Y) = (Y, X)
	isSwaped = True
dist = X + Y
if dist % K == 0:
	(rx, ry) = (0, 0)
else:
	if dist % 2 == 0:
		if K % 2 == 0:
			if dist <= 2 * K:
				R = 2 * K
			else:
				R = -(-dist // K) * K
		else:
			R = -(-dist // (2 * K)) * 2 * K
	elif K % 2 == 0:
		print(-1)
		return
	elif dist <= 3 * K:
		R = 3 * K
	else:
		R = -(-(dist - K) // (2 * K)) * 2 * K + K
	r = (R - dist) // 2
	if r < K:
		(rx, ry) = (0, r)
	else:
		rx = r // 2
		ry = r - rx
anss = []
(x, y) = (0, 0)
if -ry < y:
	dy = y + ry
	y -= dy
	x += K - dy
	anss.append((x, y))
num = (X + rx - x) // K
for _ in range(num):
	x += K
	anss.append((x, y))
if x < X + rx:
	dx = X + rx - x
	x += dx
	y += K - dx
	anss.append((x, y))
num = (Y - y) // K
for _ in range(num):
	y += K
	anss.append((x, y))
if y < Y:
	dy = Y - y
	y += dy
	x -= K - dy
	anss.append((x, y))
print(len(anss))
if isSwaped:
	print('\n'.join([str(x[1] * mx) + ' ' + str(x[0] * my) for x in anss]))
else:
	print('\n'.join([str(x[0] * mx) + ' ' + str(x[1] * my) for x in anss]))


K = int(input())
(X, Y) = [int(_) for _ in input().split()]
(x, signx) = (abs(X), -1 if X < 0 else 1)
(y, signy) = (abs(Y), -1 if Y < 0 else 1)
ans = [(x, y)]

def calcxy(x, y):
	dx = min(K, x)
	dy = K - dx
	x -= dx
	if y > dy:
		y -= dy
	else:
		y += dy
	return (x, y)

def calczw(x, y):
	if x > y:
		z = (x - y) // 2
		w = K - z
	else:
		w = (y - x) // 2
		z = K - w
	return (z, w)
if x + y != K:
	while x + y > 2 * K:
		(x, y) = calcxy(x, y)
		ans += [(x, y)]
	(z, w) = calczw(x, y)
	if abs(z - x) + abs(w - y) != K:
		(x, y) = calcxy(x, y)
		ans += [(x, y)]
		(z, w) = calczw(x, y)
	if abs(z - x) + abs(w - y) != K:
		print(-1)
		return
	ans += [(z, w)]
print(len(ans))
for (x, y) in ans[::-1]:
	print((x * signx, y * signy))


def main():
	k = int(input())
	(x, y) = map(int, input().split())

	def calc(x, y, k):
		(x_sign, y_sign, xy_swap) = (1, 1, 0)
		if x < 0:
			x_sign = -1
			x *= -1
		if y < 0:
			y_sign = -1
			y *= -1
		if x < y:
			xy_swap = 1
			(x, y) = (y, x)
		ans = []
		d = x + y
		cnt = d // k

		def pattern_0(x, y):
			(x_now, y_now) = (0, 0)
			ans = []
			cnt = (x + y) // k
			j = cnt
			for i in range(cnt):
				if x_now + k < x:
					x_now += k
					ans.append([x_now, y_now])
				else:
					y_now = k - x + x_now
					x_now = x
					ans.append([x_now, y_now])
					j = i + 1
					break
			return ans + [[x, y_now + (i - j + 1) * k] for i in range(j, cnt)]

		def pattern_1_even(x, y):
			return [[(x + y) // 2, (x + y) // 2 - k], [x, y]]

		def pattern_1_odd(x, y):
			if k % 2 == 0:
				return -1
			return [[k, 0]] + [[-i + k, j] for (i, j) in pattern_1_even(k - x, y)]

		def pattern_2_even(x, y):
			cnt = (x + y) // k
			if k % 2 == 0 or cnt % 2 == 1:
				l = (k * (cnt + 1) - (x + y)) // 2
			else:
				l = (k * (cnt + 2) - (x + y)) // 2
			if cnt != 1:
				temp = [min(2 * (k - l), x), max(2 * (k - l) - x, 0)]
				return [[k - l, -l], temp] + [[i + temp[0], j + temp[1]] for (i, j) in pattern_0(x - temp[0], y - temp[1])]
			else:
				return [[k - l, -l], [x, y]]

		def pattern_2_odd(x, y):
			cnt = (x + y) // k
			if k % 2 == 0:
				return -1
			else:
				if x - k + y < k:
					if x - k < y:
						return [[k, 0]] + [[j + k, i] for (i, j) in pattern_1_even(y, x - k)]
					else:
						return [[k, 0]] + [[i + k, j] for (i, j) in pattern_1_even(x - k, y)]
				if x - k < y:
					return [[k, 0]] + [[j + k, i] for (i, j) in pattern_2_even(y, x - k)]
				else:
					return [[k, 0]] + [[i + k, j] for (i, j) in pattern_2_even(x - k, y)]
		if d % k == 0:
			temp = pattern_0(x, y)
		elif cnt == 0:
			if d % 2 == 0:
				temp = pattern_1_even(x, y)
			else:
				temp = pattern_1_odd(x, y)
		elif d % 2 == 0:
			temp = pattern_2_even(x, y)
		else:
			temp = pattern_2_odd(x, y)
		if temp == -1:
			return -1
		if xy_swap:
			temp = [[j * x_sign, i * y_sign] for (i, j) in temp]
		else:
			temp = [[i * x_sign, j * y_sign] for (i, j) in temp]
		return temp

	def out(x, y, k):
		temp = calc(x, y, k)
		if temp == -1:
			print(-1)
			return 0
		print(len(temp))
		for i in temp:
			print(*i)
	out(x, y, k)
main()


k = int(input())
(x, y) = [int(item) for item in input().split()]
x_minus = False
if x < 0:
	x *= -1
	x_minus = True
y_minus = False
if y < 0:
	y *= -1
	y_minus = True
y_lt_x = False
if y > x:
	(x, y) = (y, x)
	y_lt_x = True
if k % 2 == 0 and (x + y) % 2 == 1:
	print(-1)
	return
step_num = (x + y + (k - 1)) // k
d = (step_num * k - x - y) // 2
while d != 0 and (k > x + d or k > y + d + x):
	step_num += 1
	d = (step_num * k - x - y) // 2
if step_num * k % 2 != (x + y) % 2:
	step_num += 1
	d = (step_num * k - x - y) // 2
ans = []
step_len = 0
on_top = False
for i in range(step_num):
	step_len += k
	if step_len <= y + d:
		ans.append([0, step_len])
	elif step_len <= y + d + x:
		on_top = True
		ans.append([step_len - y - d, y + d])
	else:
		ans.append([x, y + d - (step_len - y - d - x)])
		if not on_top:
			(newx, newy) = ans[-1]
			(prevx, prevy) = ans[-2]
			if newy > prevy:
				b = abs(prevy - newy)
				a = k - abs(prevx - newx) - abs(prevy - newy)
				ans.pop()
				ans.append([newx + b + a // 2, newy - b - a // 2])
			else:
				a = k - abs(prevx - newx) - abs(prevy - newy)
				ans.pop()
				ans.append([newx + a // 2, newy - a // 2])
			on_top = True
print(len(ans))
for (x, y) in ans:
	if y_lt_x:
		(x, y) = (y, x)
	if x_minus:
		x *= -1
	if y_minus:
		y *= -1
	print(x, y)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
K = int(input())
(X, Y) = map(int, input().split())
if (X + Y) % 2 != 0 and K % 2 == 0:
	print(-1)
	return

def strategy(x, y, K):
	if x < 0:
		(dx, dy) = strategy(-x, y, K)
		return (-dx, dy)
	if y < 0:
		(dx, dy) = strategy(x, -y, K)
		return (dx, -dy)
	if x > y:
		(dx, dy) = strategy(y, x, K)
		return (dy, dx)
	L = x + y
	if L > 2 * K:
		dx = min(x, K)
		dy = K - dx
		return (dx, dy)
	if L == K:
		return (x, y)
	if (x + y) % 2 == 0:
		t = (y - x) // 2
		(dx, dy) = (K - t, t)
		return (dx, dy)
	dx = min(K, x)
	dy = K - dx
	return (dx, dy)
(x, y) = (0, 0)
answer = []
while x != X or y != Y:
	(dx, dy) = strategy(X - x, Y - y, K)
	x += dx
	y += dy
	answer.append((x, y))
print(len(answer))
for (x, y) in answer:
	print(x, y)


def editarr(x, y, arr):
	if abs(x) >= abs(y):
		for i in range(len(arr)):
			(arr[i][0], arr[i][1]) = (arr[i][1], arr[i][0])
	if x < 0:
		for i in range(len(arr)):
			arr[i][0] *= -1
	if y < 0:
		for i in range(len(arr)):
			arr[i][1] *= -1
k = int(input())
(x, y) = map(int, input().split())
ans = []
tx = abs(x)
ty = abs(y)
if tx >= ty:
	(tx, ty) = (ty, tx)
if k % 2 == 0 and (tx + ty) % 2 != 0:
	print(-1)
else:
	if tx + ty < k:
		if (tx + ty) % 2 == 0:
			m = (ty - tx) // 2
			ans.append([k - m, m])
		else:
			td = k - (tx + ty)
			ans.append([tx, ty + td])
			ans.append([tx + (k - td // 2), ty + td // 2])
		ans.append([tx, ty])
		n = len(ans)
	elif ty - (k - tx % k) < k and (ty - (k - tx % k)) % 2 != 0:
		if tx < k and ty < k:
			if (2 * k - (tx + ty)) % 2 == 0:
				td = 2 * k - (tx + ty)
				ans.append([tx + td // 2, k - (tx + td // 2)])
				ans.append([tx, ty])
			else:
				ans.append([tx, k - tx])
				td = ty - (k - tx)
				ans.append([tx + (k - td // 2), ans[-1][1] + td // 2])
				ans.append([tx, ty])
			n = len(ans)
		elif tx + ty < 2 * k:
			if (2 * k - (tx + ty)) % 2 == 0:
				td = 2 * k - (tx + ty)
				ans.append([tx + td // 2, k - (tx + td // 2)])
				ans.append([tx, ty])
			else:
				ans.append([tx, k - tx])
				td = ty - (k - tx)
				ans.append([tx + (k - td // 2), ans[-1][1] + td // 2])
				ans.append([tx, ty])
			n = len(ans)
		else:
			ans.append([0, 0])
	else:
		ans.append([0, 0])
		for i in range(tx // k):
			ans.append([ans[-1][0] + k, 0])
		if ans[-1][0] != tx:
			ans.append([tx, k - abs(tx - ans[-1][0])])
		td = ty - ans[-1][1]
		if td % k == 0:
			flag = True
		else:
			flag = False
		for i in range(td // k):
			if flag == False and (ty - ans[-1][1]) % 2 == 0 and (ty - ans[-1][1] <= 2 * k):
				break
			ans.append([tx, ans[-1][1] + k])
		if ans[-1][1] != ty:
			td = ty - ans[-1][1]
			ans.append([tx + (k - td // 2), ans[-1][1] + td // 2])
			ans.append([tx, ty])
		ans.pop(0)
		n = len(ans)
	editarr(x, y, ans)
	print(n)
	for (a, b) in ans:
		print(a, b)


import sys
sys.setrecursionlimit(300000)

def solve(x, y, k):
	if x == y == 0:
		return []
	if x < 0:
		return [(-x, y) for (x, y) in solve(-x, y, k)]
	if y < 0:
		return [(x, -y) for (x, y) in solve(x, -y, k)]
	if x > y:
		return [(x, y) for (y, x) in solve(y, x, k)]
	if (x + y) % k == 0:
		return [(k, 0)] * (x // k) + [(0, k)] * (y // k) + ([] if x % k == y % k == 0 else [(x % k, y % k)])
	if x + y >= 2 * k:
		if x % k + y % k >= k:
			return [(k, 0)] * (x // k) + [(0, k)] * (y // k) + solve(x % k, y % k, k)
		else:
			return ([(k, 0)] * (x // k) + [(0, k)] * (y // k))[:-1] + solve(x % k, y % k + k, k)
	if x + y < K and (x + y) % 2 == 1:
		return solve(x, y + k, k) + [(0, -k)]
	if K & 1 and x + y > k and ((x + y) % k % 2 == 0):
		return solve(x, y - k, k) + [(0, k)]
	z = (x + y) // 2
	return [(k - z + x, z - x), (z - k, z)]
(K, X, Y) = map(int, open(0).read().split())
if K % 2 == 0 and (X + Y) % 2 == 1:
	print(-1)
else:
	ans = solve(X, Y, K)
	print(len(ans))
	(ax, ay) = (0, 0)
	for (x, y) in ans:
		ax += x
		ay += y
		print(ax, ay)


import sys
input = sys.stdin.readline
K = int(input())
(X, Y) = list(map(int, input().split()))
if K % 2 == 0 and (X + Y) % 2 == 1:
	print(-1)
	return
ANS = []
NOWX = 0
NOWY = 0

def dis(NOWX, NOWY, X, Y):
	return abs(NOWX - X) + abs(NOWY - Y)

def app():
	ANS.append((NOWX, NOWY))
if dis(NOWX, NOWY, X, Y) < K and dis(NOWX, NOWY, X, Y) % 2 == 1:
	if X > 0:
		NOWX -= K
		app()
	elif X < 0:
		NOWX += K
		app()
	elif Y > 0:
		NOWY -= K
		app()
	elif Y < 0:
		NOWY += K
		app()
while dis(NOWX, NOWY, X, Y) > 2 * K:
	if X - NOWX > K:
		NOWX += K
		app()
	elif NOWX - X > K:
		NOWX -= K
		app()
	elif Y - NOWY > K:
		NOWY += K
		app()
	elif NOWY - Y > K:
		NOWY -= K
		app()
if dis(NOWX, NOWY, X, Y) != K and dis(NOWX, NOWY, X, Y) % 2 == 1:
	if X - NOWX > 0:
		NOWX += K
		app()
	elif NOWX - X > 0:
		NOWX -= K
		app()
	elif Y - NOWY > 0:
		NOWY += K
		app()
	elif NOWY - Y > 0:
		NOWY -= K
		app()
if dis(NOWX, NOWY, X, Y) == K:
	ANS.append((X, Y))
else:
	t = dis(NOWX, NOWY, X, Y)
	u = (K * 2 - t) // 2
	if abs(NOWY - Y) <= abs(NOWX - X):
		if X < NOWX and Y >= NOWY:
			ANS.append((NOWX - (K - u), NOWY - u))
			ANS.append((X, Y))
		elif X < NOWX and Y <= NOWY:
			ANS.append((NOWX - (K - u), NOWY + u))
			ANS.append((X, Y))
		elif X > NOWX and Y >= NOWY:
			ANS.append((NOWX + (K - u), NOWY - u))
			ANS.append((X, Y))
		elif X > NOWX and Y <= NOWY:
			ANS.append((NOWX + (K - u), NOWY + u))
			ANS.append((X, Y))
	elif X <= NOWX and Y > NOWY:
		ANS.append((NOWX + u, NOWY + (K - u)))
		ANS.append((X, Y))
	elif X <= NOWX and Y < NOWY:
		ANS.append((NOWX + u, NOWY - (K - u)))
		ANS.append((X, Y))
	elif X >= NOWX and Y > NOWY:
		ANS.append((NOWX - u, NOWY + (K - u)))
		ANS.append((X, Y))
	elif X >= NOWX and Y < NOWY:
		ANS.append((NOWX - u, NOWY - (K - u)))
		ANS.append((X, Y))
print(len(ANS))
for (x, y) in ANS:
	print((x, y))


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
k = II()
(x, y) = MI()
if k % 2 == 0 and (x + y) % 2:
	print(-1)
	return
cx = -1 if x < 0 else 1
cy = -1 if y < 0 else 1
(x, y) = (abs(x), abs(y))
swap = False
if x > y:
	swap = True
	(x, y) = (y, x)
ans = []
if (x + y) % 2 and x + y < k:
	ans.append((x, y))
	y += k
l = (x + y + k - 1) // k * k
if (l - x - y) % 2:
	l += k
d = (l - x - y) // 2
if d > 0 and d + y < k:
	d += k // 2
if d:
	ans.append((x, y))
	x += d
	y -= k - d
while y - k >= 0:
	ans.append((x, y))
	y -= k
if y:
	ans.append((x, y))
	x -= k - y
	y = 0
while x > 0:
	ans.append((x, y))
	x -= k
print(len(ans))
for (x, y) in ans[::-1]:
	if swap:
		(x, y) = (y, x)
	print(cx * x, cy * y)


K = int(input())
(X, Y) = list(map(int, input().split()))
P = []
(x, y) = (0, 0)
while (x, y) != (X, Y):
	dx = abs(X - x)
	dy = abs(Y - y)
	D = dx + dy
	if D == K:
		(x, y) = (X, Y)
	elif D % 2 != 0 and K % 2 == 0:
		print(-1)
		return
	elif D % 2 == 0 and D <= 2 * K:
		pos = D // 2
		shift = (2 * K - D) // 2
		if pos <= dx:
			x += pos if X > x else -pos
			y -= shift if Y > y else -shift
		else:
			x = X + (shift if X > x else -shift)
			y += pos - dx if Y > y else -(pos - dx)
	elif D < K:
		x -= K if X > x else -K
	elif dx >= K:
		x += K if X > x else -K
	else:
		x = X
		y += K - dx if Y > y else -(K - dx)
	P.append((x, y))
print(len(P))
for (x, y) in P:
	print((x, y))


k = int(input())
(x, y) = map(int, input().split())

def golf(a, b):
	if a < 0:
		t = golf(-a, b)
		return (-t[0], t[1])
	if b < 0:
		t = golf(a, -b)
		return (t[0], -t[1])
	if a > b:
		t = golf(b, a)
		return (t[1], t[0])
	if a + b >= 2 * k:
		return (a, b - k)
	if a + b == k:
		return (0, 0)
	r = k - (a + b) // 2
	return (-r, a + b + r - k)
if k % 2 == 0 and (x + y) % 2 == 1:
	print(-1)
else:
	res = []
	while x or y:
		res.append([x, y])
		(x, y) = golf(x, y)
	print(len(res))
	for r in res[::-1]:
		print(r[0], r[1])


import itertools
K = int(input())
(X, Y) = list(map(int, input().split()))
Mdist = abs(X) + abs(Y)
if Mdist % 2 == 1 and K % 2 == 0:
	print(-1)
	return

def searcheven(x, y):
	if abs(x) + abs(y) > 2 * K:
		return None
	if (abs(x) + abs(y)) % 2 == 1:
		return None
	for ps in itertools.product([-1, 1], repeat=4):
		(p1, p2, p3, p4) = ps
		if p1 * p4 == p2 * p3:
			if p3 * (K - p1 * x - p2 * y) == -p1 * K:
				(a, b) = (0, p4 * K)
				if abs(x - a) + abs(y - b) == K and abs(a) + abs(b) == K:
					return (a, b)
				(a, b) = (p3 * K, 0)
				if abs(x - a) + abs(y - b) == K and abs(a) + abs(b) == K:
					return (a, b)
			else:
				pass
		else:
			tmp1 = K - p1 * x - p2 * y
			tmp2 = K
			tmp3 = p4 * tmp1 + p2 * tmp2
			tmp4 = -p3 * tmp1 - p1 * tmp2
			det = -p1 * p4 + p2 * p3
			(a, b) = (tmp3 // det, tmp4 // det)
			if abs(x - a) + abs(y - b) == K and abs(a) + abs(b) == K:
				return (a, b)
			else:
				pass
	return None
ans = [(0, 0)]
while True:
	(nx, ny) = ans[-1]
	if abs(nx - X) + abs(ny - Y) <= 2 * K:
		if (abs(nx - X) + abs(ny - Y)) % 2 == 0:
			(p, q) = searcheven(X - nx, Y - ny)
			ans.append((p + nx, q + ny))
			ans.append((X, Y))
			break
		else:
			if abs(nx - X) + abs(ny - Y) == K:
				ans.append((X, Y))
				break
			tmpx = K // 2
			tmpy = K - tmpx
			nextkouho = [(tmpx, tmpy), (tmpx, -tmpy), (-tmpx, tmpy), (-tmpx, -tmpy), (K, 0), (-K, 0), (0, K), (0, -K)]
			for point in nextkouho:
				(ptmp, qtmp) = point
				p = ptmp + nx
				q = qtmp + ny
				if abs(X - p) + abs(Y - q) <= 2 * K:
					ans.append((p, q))
					break
	elif abs(nx) + K <= abs(X):
		if X < 0:
			ans.append((nx - K, ny))
			continue
		else:
			ans.append((nx + K, ny))
			continue
	elif abs(ny) + K <= abs(Y):
		if Y < 0:
			ans.append((nx, ny - K))
			continue
		else:
			ans.append((nx, ny + K))
			continue
s = len(ans) - 1
flag = 1
for i in range(s):
	(ax, ay) = ans[i]
	(bx, by) = ans[i + 1]
	if abs(ax - bx) + abs(ay - by) == K:
		pass
	else:
		flag = 0
		break
if flag == 0:
	print('NG')
print(s)
for i in range(1, s + 1):
	print((ans[i][0], ans[i][1]))


k = int(input())
(x, y) = list(map(int, input().split()))
if abs(x) + abs(y) == k:
	print(1)
	print((x, y))
	return
cx = cy = cxy = False
if x < 0:
	x = -x
	cx = True
if y < 0:
	y = -y
	cy = True
if x < y:
	(x, y) = (y, x)
	cxy = True
if k % 2 == 0 and (x + y) % 2 == 1:
	print(-1)
	return
ans = []
n = max((x + y + k - 1) // k, 2)
if (x + y) % 2 != n * k % 2:
	n += 1
if x < k and n == 3:
	mid = (k + x - y) // 2
	ans.append([x, x - k])
	ans.append([x + mid, y - k + mid])
	ans.append([x, y])
else:
	over = (n * k - x - y) // 2
	for i in range(1, n + 1):
		d = i * k
		if d <= y + over:
			ans.append([0, d])
		elif d <= y + over + x:
			ans.append([d - over - y, y + over])
		else:
			ans.append([x, y + (n - i) * k])
if cxy:
	ans = [[i, j] for (j, i) in ans]
if cx:
	ans = [[-i, j] for (i, j) in ans]
if cy:
	ans = [[i, -j] for (i, j) in ans]
print(n)
for (i, j) in ans:
	print((i, j))


def e_golf(K, X, Y):
	is_xpos_negative = is_ypos_negative = is_swap = False
	(x, y) = (X, Y)
	if x < 0:
		x *= -1
		is_xpos_negative = True
	if y < 0:
		y *= -1
		is_ypos_negative = True
	if x < y:
		(x, y) = (y, x)
		is_swap = True
	if (x + y) % 2 == 1 and K % 2 == 0:
		return -1
	ans = []
	shot_min = max((x + y + K - 1) // K, 2)
	if (x + y) % 2 != shot_min * K % 2:
		shot_min += 1
	if x + y == K:
		ans.append((x, y))
	elif shot_min == 3 and x < K:
		mid = (K + x - y) // 2
		ans.extend(((x, x - K), (x + mid, y - K + mid), (x, y)))
	else:
		over = (shot_min * K - x - y) // 2
		for i in range(1, shot_min + 1):
			d = i * K
			if d <= y + over:
				ans.append((0, d))
			elif d <= y + over + x:
				ans.append((d - y - over, y + over))
			else:
				ans.append((x, y + (shot_min - i) * K))
	if is_swap:
		ans = [(second, first) for (first, second) in ans]
	if is_xpos_negative:
		ans = [(-first, second) for (first, second) in ans]
	if is_ypos_negative:
		ans = [(first, -second) for (first, second) in ans]
	return '\n'.join([str(len(ans))] + ['{} {}'.format(f, s) for (f, s) in ans])
K = int(input())
(X, Y) = [int(i) for i in input().split()]
print(e_golf(K, X, Y))


K = int(input())
(X, Y) = map(int, input().split())
(sgn_X, sgn_Y) = (1, 1)
if X < 0:
	X = -X
	sgn_X = -1
if Y < 0:
	Y = -Y
	sgn_Y = -1
if K % 2 == 0 and (X + Y) % 2 == 1:
	print(-1)
else:
	(xx, yy) = (0, 0)
	vec_list = []
	while X - xx + (Y - yy) > 2 * K:
		if X - xx > K:
			xx += K
			vec_list.append((K, 0))
		elif Y - yy > K:
			yy += K
			vec_list.append((0, K))
	diff_x = X - xx
	diff_y = Y - yy
	if K % 2 == 0:
		if diff_x + diff_y == K:
			vec_list.append((diff_x, diff_y))
		else:
			buf = 2 * K - (diff_x + diff_y)
			if diff_x + buf // 2 <= K:
				vec_list.append((diff_x + buf // 2, K - (diff_x + buf // 2)))
				vec_list.append((-buf // 2, K - buf // 2))
			elif diff_y + buf // 2 <= K:
				vec_list.append((K - (diff_y + buf // 2), diff_y + buf // 2))
				vec_list.append((K - buf // 2, -buf // 2))
			else:
				raise 'Error'
	elif diff_x + diff_y == K:
		vec_list.append((diff_x, diff_y))
	else:
		if (diff_x + diff_y) % 2 == 1:
			if diff_x <= K:
				xx += diff_x
				if K - diff_x < diff_y:
					yy += K - diff_x
					vec_list.append((diff_x, K - diff_x))
				else:
					yy -= K - diff_x
					vec_list.append((diff_x, -K + diff_x))
			elif diff_y <= K:
				yy += diff_y
				if K - diff_y < diff_x:
					xx += K - diff_y
					vec_list.append((K - diff_y, diff_y))
				else:
					xx -= K - diff_y
					vec_list.append((-K + diff_y, diff_y))
		diff_x = X - xx
		diff_y = Y - yy
		buf = 2 * K - (diff_x + diff_y)
		if diff_x + buf // 2 <= K:
			vec_list.append((diff_x + buf // 2, K - (diff_x + buf // 2)))
			vec_list.append((-buf // 2, K - buf // 2))
		elif diff_y + buf // 2 <= K:
			vec_list.append((K - (diff_y + buf // 2), diff_y + buf // 2))
			vec_list.append((K - buf // 2, -buf // 2))
		else:
			raise 'Error'
	print(len(vec_list))
	(pos_x, pos_y) = (0, 0)
	for (x, y) in vec_list:
		pos_x += sgn_X * x
		pos_y += sgn_Y * y
		print(pos_x, pos_y)


i = input
k = int(i())
(x, y) = list(map(int, i().split()))
(x, y) = (x - y, x + y)

def cc(x, xs):
	if abs(x - xs) <= 2 * k and abs(x - xs) % 2 == 0:
		return (1, x + (k if abs(x + k - xs) <= abs(x - k - xs) else -k))
	return (0, xs + (k if x - xs > 0 else -k))
if (k % 2, x % 2) == (0, 1):
	print(-1)
else:
	rs = []
	(xs, ys) = (0, 0)
	while True:
		if abs(x - xs) == k or abs(y - ys) == k:
			if abs(x - xs) <= k and abs(y - ys) <= k:
				rs += ['{} {}'.format((x + y) // 2, (y - x) // 2)]
				break
		(mm, ys) = cc(y, ys)
		if mm:
			xs = xs + (k if x > xs else -k)
		else:
			(mm, xs) = cc(x, xs)
		rs += ['{} {}'.format((xs + ys) // 2, (ys - xs) // 2)]
	print(len(rs))
	print('\n'.join(rs))


K = int(input())
(X, Y) = map(int, input().split())
ans = [(X, Y)]
(x, y) = ans[-1]
while abs(x) >= 3 * K // 2:
	(x, y) = ans[-1]
	if x >= K:
		x -= K
	elif x <= -K:
		x += K
	ans.append((x, y))
dx = abs(x)
while abs(y) > 2 * K - dx:
	(x, y) = ans[-1]
	if y > 0:
		y -= K
	else:
		y += K
	ans.append((x, y))
(x, y) = ans[-1]
if abs(y) + abs(x) != K:
	if (x + y) % 2 == 0 and K % 2 == 0:
		d2 = (abs(x) + abs(y)) // 2
		if abs(x) > abs(y):
			x -= d2 * (1 if x > 0 else -1)
			y += (K - d2) * (1 if y > 0 else -1)
		else:
			x += (K - d2) * (1 if x > 0 else -1)
			y -= d2 * (1 if y > 0 else -1)
		ans.append((x, y))
	else:
		if (x + y + K) % 2 == 0:
			y -= K if y > 0 else -K
			ans.append((x, y))
		d = abs(x) + abs(y)
		if abs(x) > abs(y):
			x -= d // 2 * (1 if x > 0 else -1)
			y += (K - d // 2) * (1 if y > 0 else -1)
		else:
			x += (K - d // 2) * (1 if x > 0 else -1)
			y -= d // 2 * (1 if y > 0 else -1)
		ans.append((x, y))
(x, y) = ans[-1]
if abs(x) + abs(y) != K:
	print(-1)
else:
	ans = ans[::-1]
	print(len(ans))
	for out in ans:
		print(*out)


k = int(input())
(x, y) = map(int, input().split())

def sign(x):
	return 1 if x > 0 else -1
if (abs(x) + abs(y)) % 2 == 1 and k % 2 == 0:
	print(-1)
else:
	(cx, cy) = (0, 0)
	ret = []
	while x != cx or y != cy:
		if abs(x - cx) + abs(y - cy) == k:
			(cx, cy) = (x, y)
		elif abs(x - cx) + abs(y - cy) <= 2 * k:
			dx = abs(x - cx)
			dy = abs(y - cy)
			rem = 2 * k - dx - dy
			if dx > dy:
				cy += (dy + rem // 2) * sign(y - cy)
				cx += (k - dy - rem // 2) * sign(x - cx)
			else:
				cx += (dx + rem // 2) * sign(x - cx)
				cy += (k - dx - rem // 2) * sign(y - cy)
		elif abs(x - cx) > abs(y - cy):
			cx += sign(x - cx) * k
		else:
			cy += sign(y - cy) * k
		ret.append((cx, cy))
	print(len(ret))
	for (cx, cy) in ret:
		print(cx, cy)


import math

def swap(X, Y):
	temp = X
	X = Y
	Y = temp
	return (X, Y)

def keiro(count, X, Y, K):
	keirolist = []
	oneway_surplus = int((count * K - X - Y) / 2)
	move = 0
	turncount = 0
	prevX = 0
	prevY = 0
	while move < count:
		if turncount == 0:
			if K - prevY >= oneway_surplus:
				prevX = K - oneway_surplus
				prevY -= oneway_surplus
				turncount += 1
			else:
				prevX = 0
				prevY -= K
		elif turncount == 1:
			if K + prevX > X:
				prevY += K - (X - prevX)
				prevX = X
				turncount += 1
			else:
				prevX += K
		else:
			prevY += K
		keirolist.append([prevX, prevY])
		move += 1
	return keirolist

def ans(K, X, Y):
	anslist = []
	count = 0
	Xminus = 0
	Yminus = 0
	swapflag = 0
	if X < 0:
		Xminus = 1
		X = abs(X)
	if Y < 0:
		Yminus = 1
		Y = abs(Y)
	if X + Y == K:
		count = 1
		anslist.append([X, Y])
	else:
		if X < Y:
			(X, Y) = swap(X, Y)
			swapflag = 1
		if X + Y > K:
			count = math.ceil((X + Y) / K)
			lastflag = 0
			if (count * K - X - Y) % 2 == 1:
				count += 1
				lastflag = 1
			anslist = keiro(count, X, Y, K)
		elif (X + Y) % 2 == 0:
			count = 2
			anslist = keiro(count, X, Y, K)
		else:
			count = 3
			anslist.append([X, -K + X])
			Xsurplus = int((X + K - Y) / 2)
			anslist.append([X + Xsurplus, X - Xsurplus])
			anslist.append([X, Y])
	for ans in anslist:
		if swapflag == 1:
			(ans[0], ans[1]) = swap(ans[0], ans[1])
		if Xminus == 1:
			ans[0] = -ans[0]
		if Yminus == 1:
			ans[1] = -ans[1]
	return (count, anslist)
K = int(input())
(X, Y) = map(int, input().split())
if K % 2 == 0 and (X + Y) % 2 == 1:
	print(-1)
	return
(count, anslist) = ans(K, X, Y)
print(count)
for ans in anslist:
	print(ans[0], ans[1])


import random

def copysign(x, y):
	return abs(x) * (1 if y >= 0 else -1)

def dist(k, x, y):
	if not abs(x) + abs(y) < 2 * k:
		return None
	if x == y == 0:
		return 0
	elif abs(x) + abs(y) == k:
		return 1
	elif (abs(x) + abs(y)) % 2 == 0:
		return 2
	else:
		return 3

def iterate_neighbors(k, x, y):
	assert abs(x) + abs(y) < 2 * k
	dz = (2 * k - abs(x) - abs(y)) // 2
	for dx in (dz, k - dz):
		dy = k - dx
		yield (dx, dy)
		yield (dx, -dy)
		yield (-dx, dy)
		yield (-dx, -dy)

def solve(k, x, y):
	while True:
		d = dist(k, x, y)
		if d == 0:
			return
		elif d == 1:
			dx = x
			dy = y
		elif d == 2:
			for (dx, dy) in iterate_neighbors(k, x, y):
				if dist(k, x - dx, y - dy) == 1:
					break
			else:
				assert False
		elif d == 3:
			while True:
				dx = random.randint(0, k) * random.choice([-1, 1])
				dy = (k - abs(dx)) * random.choice([-1, 1])
				if dist(k, x - dx, y - dy) == 2:
					break
		else:
			dx = copysign(min(k, abs(x)), x)
			dy = copysign(k - abs(dx), y)
		yield (dx, dy)
		x -= dx
		y -= dy

def main():
	k = int(input())
	(x, y) = list(map(int, input().split()))
	if k % 2 == 0 and (abs(x) + abs(y)) % 2 != 0:
		print(-1)
		return
	ops = list(solve(k, x, y))
	print(len(ops))
	x = 0
	y = 0
	for (dx, dy) in ops:
		x += dx
		y += dy
		print((x, y))
main()


k = int(input())
(x, y) = map(int, input().split())
if x < 0:
	fx = -1
else:
	fx = 1
if y < 0:
	fy = -1
else:
	fy = 1
(ax, ay) = (abs(x), abs(y))
if ax < ay:
	(x, y) = (y, x)
	(ax, ay) = (ay, ax)
	(fx, fy) = (fy, fx)
	flag = 1
else:
	flag = 0
r = ax + ay
if k % 2 == 0 and r % 2 == 1:
	print(-1)
	return
if r == k:
	print(1)
	if flag:
		(x, y) = (y, x)
	print(x, y)
	return
if r % 2 == 1 and r < k:
	print(3)
	anss = []
	anss.append(((ax + (k - ay)) // 2, k - (ax + (k - ay)) // 2))
	anss.append((ax + (k - ay), 0))
	anss.append((ax, ay))
	for (i, j) in anss:
		(ii, jj) = (i * fx, j * fy)
		if flag:
			(ii, jj) = (jj, ii)
		print(ii, jj)
	return
if r % 2 == 0 and r < k:
	rm = (2 * k - ax - ay) // 2
else:
	rn = (k - r % k) % k
	if rn % 2 == 1:
		rn += k
	rm = rn // 2
ans = (r + rm * 2) // k
anss = [] * ans
print(ans)
first = [0, -rm]
second = [ax, -rm]
third = [ax, ay]
xx = yy = 0
while yy > first[1]:
	if yy - k <= first[1]:
		xx += k - (yy - first[1])
		yy = first[1]
	else:
		yy -= k
	anss.append((xx * fx, yy * fy))
while xx < second[0]:
	if xx + k >= second[0]:
		yy += k - (second[0] - xx)
		xx = second[0]
	else:
		xx += k
	anss.append((xx * fx, yy * fy))
while yy != third[1]:
	yy += k
	anss.append((xx * fx, yy * fy))
for (i, j) in anss:
	(ii, jj) = (i, j)
	if flag:
		(ii, jj) = (jj, ii)
	print(ii, jj)


k = int(input())
(X, Y) = map(int, input().split())
x = max(abs(X), abs(Y))
y = min(abs(X), abs(Y))
c = (k - (x + y) % k) % k
if k % 2 == 0 and (x + y) % 2 == 1:
	print(-1)
	return
import math
ans = []
m = math.ceil((x + y) / k)
if (x + y) / k == int((x + y) / k):
	for i in range(m):
		ans.append((min(x, k * i + k), max(0, k * i + k - x)))
elif m == 1:
	if (x + y) % 2 == 1:
		ans.append((x, x - k))
		ans.append((x + (k + x - y) // 2, (-k + x + y) // 2))
		ans.append((x, y))
	else:
		ans.append(((x + y) // 2, -k + (x + y) // 2))
		ans.append((x, y))
elif c % 2 == 0 and x + y >= k:
	a = abs((k * m - x - y) // 2)
	for i in range(m - 1):
		l = k * i + k
		if a >= l:
			ans.append((0, -l))
		elif a < l <= x + a:
			ans.append((l - a, -a))
		elif x + a < l:
			ans.append((x, l - x - 2 * a))
	ans.append((x, y))
else:
	m += 1
	a = abs((k * m - x - y) // 2)
	for i in range(m - 1):
		l = k * i + k
		if a >= l:
			ans.append((0, -1))
		elif a < l <= x + a:
			ans.append((l - a, -a))
		elif x + a < l:
			ans.append((x, l - x - 2 * a))
	ans.append((x, y))
print(len(ans))
for (i, j) in ans:
	if abs(X) < abs(Y):
		(i, j) = (j, i)
	if X < 0:
		i *= -1
	if Y < 0:
		j *= -1
	print(i, j)


def solve(k, x, y):
	if k % 2 == 0 and (x + y) % 2 == 1:
		print(-1)
		return
	ans = []
	(abx, aby) = (abs(x), abs(y))
	mh = abx + aby
	(xx, yy) = (0, 0)
	if mh % k == 0:
		d = (mh - 1) // k + 1
		for _ in range(d - 1):
			(dx, dy) = (abs(abx - xx), abs(aby - yy))
			if dx > 0:
				if dx >= k:
					xx += k
				else:
					xx += dx
					yy += k - dx
			else:
				yy += k
			ans.append((xx, yy))
		ans.append((abx, aby))
		print_ans(ans, x, y)
		return
	d = (mh - 1) // k + 1
	if k % 2 == 1 and mh % 2 != max(2, d) % 2:
		if abx > aby:
			xx += min(k, abx)
			yy += k - min(k, abx)
		else:
			yy += min(k, aby)
			xx += k - min(k, aby)
		ans.append((xx, yy))
	for _ in range(d - 2):
		(dx, dy) = (abs(abx - xx), abs(aby - yy))
		if dx > dy:
			if abx > xx:
				xx += k
			else:
				xx -= k
		elif aby > yy:
			yy += k
		else:
			yy -= k
		ans.append((xx, yy))
	(dx, dy) = (abs(abx - xx), abs(aby - yy))
	mhh = (dx + dy) // 2
	if dx > dy:
		if abx > xx:
			xx += mhh
		else:
			xx -= mhh
		if aby > yy:
			yy -= k - mhh
		else:
			yy += k - mhh
	else:
		if aby > yy:
			yy += mhh
		else:
			yy -= mhh
		if abx > xx:
			xx -= k - mhh
		else:
			xx += k - mhh
	ans.append((xx, yy))
	ans.append((abx, aby))
	print_ans(ans, x, y)

def print_ans(ans, x, y):
	print(len(ans))
	for (dx, dy) in ans:
		if x < 0:
			dx = -dx
		if y < 0:
			dy = -dy
		print((dx, dy))
k = int(input())
(x, y) = list(map(int, input().split()))
solve(k, x, y)


k = int(input())
(x, y) = [int(x) for x in input().strip().split(' ')]
(x, y) = (x - y, x + y)

def main():
	if k % 2 == 0:
		if x % 2 != 0:
			return -1
	return to(x, y)

def cc(x, xs):
	if abs(x - xs) <= 2 * k:
		if abs(x + k - xs) % 2 == k % 2:
			if abs(x + k - xs) <= abs(x - k - xs):
				xs = x + k
			else:
				xs = x - k
			return (True, xs)
		elif x > xs:
			xs += k
		else:
			xs -= k
	elif x > xs:
		xs += k
	else:
		xs -= k
	return (False, xs)

def to(x, y):
	rs = []
	(xs, ys) = (0, 0)
	while True:
		if abs(x - xs) == k or abs(y - ys) == k:
			if abs(x - xs) <= k and abs(y - ys) <= k:
				return rs + [(x, y)]
		(mm, ys) = cc(y, ys)
		if mm:
			if x > xs:
				xs += k
			else:
				xs -= k
		else:
			(mm, xs) = cc(x, xs)
		rs.append((xs, ys))

def __starting_point():
	jj = main()
	if jj == -1:
		print(-1)
	else:
		print(len(jj))
		for r in jj:
			print(((r[0] + r[1]) // 2, (r[1] - r[0]) // 2))
__starting_point()


K = int(input())
(X, Y) = list(map(int, input().split()))
if K % 2 == 0 and (X + Y) % 2:
	print(-1)
	return

def next(x, y):
	if x < 0:
		(dx, dy) = next(-x, y)
		return (-dx, dy)
	if y < 0:
		(dx, dy) = next(x, -y)
		return (dx, -dy)
	if x < y:
		(dx, dy) = next(y, x)
		return (dy, dx)
	if x + y == K:
		return (x, y)
	if x + y <= K * 2 and (x + y) % 2 == 0:
		return ((x + y) // 2, (x + y) // 2 - K)
	return (K, 0)
(x, y) = (0, 0)
ans = list()
while x != X or y != Y:
	(dx, dy) = next(X - x, Y - y)
	x += dx
	y += dy
	ans.append((x, y))
print(len(ans))
for (x, y) in ans:
	print((x, y))


k = int(input())
(x, y) = map(int, input().split())
if k % 2 == 0 and (x + y) % 2 != 0:
	print(-1)
	return

def f(x, y):
	if x < 0:
		(a, b) = f(-x, y)
		return (-a, b)
	if y < 0:
		(a, b) = f(x, -y)
		return (a, -b)
	if x < y:
		(a, b) = f(y, x)
		return (b, a)
	if x + y == k:
		return (x, y)
	if x + y <= k * 2 and (x + y) % 2 == 0:
		return ((x + y) // 2, (x + y) // 2 - k)
	return (k, 0)
(p, q) = (0, 0)
ans = []
while (p, q) != (x, y):
	(a, b) = f(x - p, y - q)
	p += a
	q += b
	ans.append(str(p) + ' ' + str(q))
print(len(ans))
print('\n'.join(ans))


def solve(x, y):
	if x < 0:
		(x, y) = solve(-x, y)
		return (-x, y)
	if y < 0:
		(x, y) = solve(x, -y)
		return (x, -y)
	if x > y:
		(x, y) = solve(y, x)
		return (y, x)
	if x + y >= 2 * K:
		return (x, y - K)
	if x + y == K:
		return (0, 0)
	r = K - (x + y) // 2
	return (-r, x + y + r - K)
(K, X, Y) = map(int, open(0).read().split())
if K % 2 == 0 and (X + Y) % 2 == 1:
	print(-1)
	return
A = []
while X or Y:
	A.append((X, Y))
	(X, Y) = solve(X, Y)
print(len(A))
for a in reversed(A):
	print(*a)


K = int(input())
(X, Y) = map(int, input().split())

def golf(a, b):
	if a < 0:
		t = golf(-a, b)
		return (-t[0], t[1])
	if b < 0:
		t = golf(a, -b)
		return (t[0], -t[1])
	if a > b:
		t = golf(b, a)
		return (t[1], t[0])
	if a + b >= K * 2:
		return (a, b - K)
	if a + b == K:
		return (0, 0)
	r = K - (a + b) // 2
	return (-r, a + b + r - K)
if K % 2 == 0 and (X + Y) % 2 == 1:
	print(-1)
else:
	res = []
	while X or Y:
		res.append((X, Y))
		(X, Y) = golf(X, Y)
	print(len(res))
	for r in res[::-1]:
		print(r[0], r[1])


import sys
K = int(input())
(X, Y) = map(int, input().split())
if (X + Y) % 2 and K % 2 == 0:
	print(-1)
	return

def solve(K, X, Y):
	if (X + Y) % 2 and K % 2 == 0:
		return None

	def gen(a, b, c, d):
		ans = []
		x = y = 0
		assert c - a == Y and b - d == X
		while a >= K:
			y -= K
			a -= K
			ans.append((0, y))
		if a:
			x += K - a
			y -= a
			b -= K - a
			ans.append((x, y))
		while b >= K:
			x += K
			b -= K
			ans.append((x, y))
		if b:
			x += b
			y += K - b
			c -= K - b
			ans.append((x, y))
		while c >= K:
			y += K
			c -= K
			ans.append((x, y))
		if c:
			x -= K - c
			y += c
			d -= K - c
			ans.append((x, y))
		while d >= K:
			x -= K
			d -= K
			ans.append((x, y))
		assert X == x and Y == y, (x, y, ans)
		assert d == 0
		return ans
	ans = []
	if X + Y < K:
		if (X + Y) % 2 == 1:
			n = 3
			ans = gen(K - X, X + (K + X - Y) // 2, K - X + Y, (K + X - Y) // 2)
		else:
			n = 2
			ans = gen((K * n - X - Y) // 2, X, (K * n - X + Y) // 2, 0)
	else:
		c = (K - (X + Y)) % K
		if c % 2 == 1:
			n = (X + Y + K - 1) // K + 1
		else:
			n = (X + Y + K - 1) // K
		ans = gen((K * n - X - Y) // 2, X, (K * n - X + Y) // 2, 0)
	assert len(ans) == n
	return ans
rx = X < 0
if rx:
	X = -X
ry = Y < 0
if ry:
	Y = -Y
r = X < Y
if r:
	(X, Y) = (Y, X)
ans = solve(K, X, Y)
if ans:
	print(len(ans))
	for (x, y) in ans:
		if r:
			(x, y) = (y, x)
		if rx:
			x = -x
		if ry:
			y = -y
		print(x, y)
else:
	print(-1)


import sys

def get(K: int, X: int, Y: int):
	p = None
	if X >= K:
		X -= K
		p = [K, 0]
	elif Y >= K:
		Y -= K
		p = [0, K]
	elif X + Y >= K:
		p = [X, K - X]
		Y -= K - X
		X = 0
	else:
		p = [-K, 0]
		X += K
	return (p, X, Y)

def jump_two(K: int, X: int, Y: int):
	assert X + Y < 2 * K
	if X + Y == 0:
		return []
	elif X + Y == K:
		return [(X, Y)]
	ret = []
	rev = False
	if X > Y:
		(X, Y) = (Y, X)
		rev = True
	a = K - (Y - X) // 2
	b = K - (Y + X) // 2
	assert 0 <= a and a <= K
	assert 0 <= b and b <= K
	ret.append([a, K - a])
	ret.append([-b, K - b])
	if rev:
		for i in range(len(ret)):
			(ret[i][0], ret[i][1]) = (ret[i][1], ret[i][0])
	return ret

def calc(K: int, X: int, Y: int):
	ret = []
	if X + Y < K:
		if (X + Y) % 2 != 0:
			(p, X, Y) = get(K, X, Y)
			ret.append(p)
		ret += jump_two(K, X, Y)
		return ret
	while X + Y >= K * 2:
		(p, X, Y) = get(K, X, Y)
		ret.append(p)
	if X + Y == K:
		ret.append([X, Y])
	else:
		if (X + Y) % 2 != 0:
			(p, X, Y) = get(K, X, Y)
			ret.append(p)
		ret += jump_two(K, X, Y)
	return ret

def solve(K: int, X: int, Y: int):
	if K % 2 == 0 and (X + Y) % 2 != 0:
		print(-1)
		return
	negate_X = False
	negate_Y = False
	if X < 0:
		X *= -1
		negate_X = True
	if Y < 0:
		Y *= -1
		negate_Y = True
	v = calc(K, X, Y)
	for i in range(len(v)):
		if negate_X:
			v[i][0] *= -1
		if negate_Y:
			v[i][1] *= -1
	x = 0
	y = 0
	print(len(v))
	for (dx, dy) in v:
		x += dx
		y += dy
		print((x, y))
	return

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	K = int(next(tokens))
	X = int(next(tokens))
	Y = int(next(tokens))
	solve(K, X, Y)

def __starting_point():
	main()
__starting_point()


def solve(v, u, k):
	sign_v = sign_u = 1
	swap = 1
	if abs(v) < abs(u):
		(v, u) = (u, v)
		swap = -1
	if v < 0:
		v = -v
		sign_v = -1
	if u < 0:
		u = -u
		sign_u = -1
	if v % k == 0:
		n = v // k
		res = []
		cum_u = 0
		for i in range(n):
			du = min(k, max(-k, u - cum_u))
			if (k + du) % 2:
				du += 1 if du < 0 else -1
			cum_u += du
			res.append([k * sign_v, du * sign_u][::swap])
		assert cum_u == u, (cum_u, u)
		return res
	elif v < k and v % 2 == 0:
		res = [[k, u - k], [v - k, k]]
		res = [[dv * sign_v, du * sign_u][::swap] for (dv, du) in res]
		return res
	else:
		m = v % k
		if (k + m) % 2:
			m -= 1
		res = [[m, k]] + solve(v - m, u - k, k)
		res = [[dv * sign_v, du * sign_u][::swap] for (dv, du) in res]
		return res

def test():
	inf = -1
	M = [[inf] * 1000 for _ in range(1000)]
	K = 9
	q = [(0, 0)]
	R = 100
	ans = 1
	M[0][0] = 0
	while q:
		q_new = []
		for (x, y) in q:
			for i in range(-K, K + 1, 2):
				ux = x + i
				uy = y + i
				if -R <= ux <= R:
					if y + K <= R:
						if M[ux][y + K] == inf:
							M[ux][y + K] = ans
							q_new.append((ux, y + K))
					if y - K >= -R:
						if M[ux][y - K] == inf:
							M[ux][y - K] = ans
							q_new.append((ux, y - K))
				if -R <= uy <= R:
					if x + K <= R:
						if M[x + K][uy] == inf:
							M[x + K][uy] = ans
							q_new.append((x + K, uy))
					if x - K >= -R:
						if M[x - K][uy] == inf:
							M[x - K][uy] = ans
							q_new.append((x - K, uy))
		q = q_new
		ans += 1
	for x in range(-R, R + 1):
		for y in range(-R, R + 1):
			if M[x][y] != -1:
				if len(solve(x, y, K)) != M[x][y]:
					print(f'!! x={x} y={y} len(solve(x, y, K))={len(solve(x, y, K))} M[x][y]={M[x][y]}')
	print('test finished')

def main():
	K = int(input())
	(X, Y) = list(map(int, input().split()))
	if K % 2 == 0 and (X + Y) % 2:
		print(-1)
		return
	(V, U) = (X + Y, X - Y)
	Ans = solve(V, U, K)
	print(len(Ans))
	cum_x = cum_y = 0
	for (v, u) in Ans:
		(x, y) = ((v + u) // 2, (v - u) // 2)
		assert abs(x) + abs(y) == K
		cum_x += x
		cum_y += y
		print(f'{cum_x} {cum_y}')
	assert cum_x == X and cum_y == Y
main()


k = int(input())
(gx, gy) = list(map(int, input().split()))
if k % 2 == 0 and (gx + gy) % 2:
	print(-1)
	return
flgx = 1
flgy = 1
if gx < 0:
	flgx -= 2
	gx *= -1
if gy < 0:
	flgy -= 2
	gy *= -1
px = 0
py = 0
ansls = []
while True:
	if gx - px + gy - py <= 2 * k:
		break
	if gx - px >= k:
		px += k
	elif gy - py >= k:
		py += k
	ansls.append((px, py))
if gx - px + gy - py <= 2 * k:
	if gx - px + gy - py == 2 * k:
		if px + k <= gx:
			px += k
		else:
			py += k
		ansls.append((px, py))
	if gx - px + gy - py == k:
		ansls.append((gx, gy))
	else:
		if (gx - px + gy - py) % 2:
			if px + k <= gx:
				px += k
			elif py + k <= gy:
				py += k
			elif px + py + k <= gx + gy:
				py += k - (gx - px)
				px = gx
			else:
				py -= gx - px
				px -= k - (gx - px)
			ansls.append((px, py))
		if gx - px <= gy - py:
			ansls.append((px + (gx - px + gy - py) // 2 - k, py + (gx - px + gy - py) // 2))
		else:
			ansls.append((px + (gx - px + gy - py) // 2, py + (gx - px + gy - py) // 2 - k))
		ansls.append((gx, gy))
for i in range(len(ansls) - 1):
	if abs(ansls[i + 1][0] - ansls[i][0]) + abs(ansls[i + 1][1] - ansls[i][1]) != k:
		print('error')
print(len(ansls))
for (x, y) in ansls:
	print((x * flgx, y * flgy))


K = int(input())
(x, y) = map(int, input().split())
(nowx, nowy) = (0, 0)
ans = []

def ok():
	nonlocal ans, x, y
	ans.append((x, y))
	print(len(ans))
	for (x, y) in ans:
		print(x, y)
	return
while abs(nowx - x) + abs(nowy - y) >= 2 * K:
	if x - nowx >= K:
		nowx += K
	elif nowx - x >= K:
		nowx -= K
	elif y - nowy >= K:
		nowy += K
	else:
		nowy -= K
	ans.append((nowx, nowy))
if (abs(nowx - x) + abs(nowy - y)) % 2 == 1 and K % 2 == 0:
	print(-1)
	return
if abs(nowx - x) + abs(nowy - y) == K:
	ok()
if (abs(nowx - x) + abs(nowy - y)) % 2 == 1:
	if abs(nowx + K - x) + abs(nowy - y) < 2 * K:
		nowx += K
	elif abs(nowx - K - x) + abs(nowy - y) < 2 * K:
		nowx -= K
	elif abs(nowx - x) + abs(nowy + K - y) < 2 * K:
		nowy += K
	elif abs(nowx - x) + abs(nowy - K - y) < 2 * K:
		nowy -= K
	ans.append((nowx, nowy))
if abs(nowx - x) + abs(nowy - y) == K:
	ok()
rest = K * 2 - (abs(nowx - x) + abs(nowy - y))
rest //= 2
(xgo, ygo) = (1, 1)
if nowx != x:
	xgo = (x - nowx) // abs(nowx - x)
if nowy != y:
	ygo = (y - nowy) // abs(nowy - y)
if abs(nowx - x) >= abs(nowy - y):
	nowx += xgo * (K - rest)
	nowy -= ygo * rest
	ans.append((nowx, nowy))
else:
	nowy += ygo * (K - rest)
	nowx -= xgo * rest
	ans.append((nowx, nowy))
ok()


import math
k = int(input())
(x, y) = list(map(int, input().split()))
if k % 2 == 0 and (x + y) % 2 == 1:
	print(-1)
	return
a = 1
b = 1
d = 0
if x < 0:
	x *= -1
	a = -1
if y < 0:
	y *= -1
	b = -1
if x < y:
	d = 1
	(x, y) = (y, x)

def show_xy(tx, ty):
	if d == 1:
		print((ty * a, tx * b))
	else:
		print((tx * a, ty * b))
if x + y < k and (x + y) % 2 == 1:
	print(3)
	temp_x = x
	temp_y = x - k
	show_xy(temp_x, temp_y)
	temp_x = x + (k + x - y) // 2
	temp_y += k - (k + x - y) // 2
	show_xy(temp_x, temp_y)
	temp_x = x
	temp_y = y
	show_xy(temp_x, temp_y)
	return
c = (k - (x + y) % k) % k
if x + y < k:
	n = 2
else:
	n = math.ceil((x + y) / k) + c % 2
print(n)
ans = 0
temp_x = 0
temp_y = 0
temp = -(k * n - x - y) // 2
while 1:
	temp_y -= k
	if temp_y >= temp:
		show_xy(temp_x, temp_y)
	else:
		temp_x = temp - temp_y
		temp_y = temp
		break
while temp_x <= x:
	show_xy(temp_x, temp_y)
	temp_x += k
temp_y += temp_x - x
temp_x = x
while temp_y <= y:
	show_xy(temp_x, temp_y)
	temp_y += k


def main():
	K = int(input())
	(X, Y) = map(int, input().split())
	if K % 2 == 0 and (X + Y) % 2 != 0:
		print(-1)
		return

	def next_vec(x, y):
		if x < 0:
			(dx, dy) = next_vec(-x, y)
			return (-dx, dy)
		if y < 0:
			(dx, dy) = next_vec(x, -y)
			return (dx, -dy)
		if x < y:
			(dx, dy) = next_vec(y, x)
			return (dy, dx)
		if x + y == K:
			return (x, y)
		if x + y <= K + K and (x + y) % 2 == 0:
			return ((x + y) // 2, (x + y) // 2 - K)
		return (K, 0)
	(x, y) = (0, 0)
	ans = []
	while (x, y) != (X, Y):
		(dx, dy) = next_vec(X - x, Y - y)
		x += dx
		y += dy
		ans.append('{} {}'.format(x, y))
	print(len(ans))
	print(*ans, sep='\n')

def __starting_point():
	main()
__starting_point()