Manao has invented a new mathematical term — a beautiful set of points. He calls a set of points on a plane beautiful if it meets the following conditions:  The coordinates of each point in the set are integers.  For any two points from the set, the distance between them is a non-integer. 

Consider all points (x, y) which satisfy the inequations: 0 ≤ x ≤ n; 0 ≤ y ≤ m; x + y > 0. Choose their subset of maximum size such that it is also a beautiful set of points.


-----Input-----

The single line contains two space-separated integers n and m (1 ≤ n, m ≤ 100).


-----Output-----

In the first line print a single integer — the size k of the found beautiful set. In each of the next k lines print a pair of space-separated integers — the x- and y- coordinates, respectively, of a point from the set.

If there are several optimal solutions, you may print any of them.


-----Examples-----
Input
2 2

Output
3
0 1
1 2
2 0

Input
4 3

Output
4
0 3
2 1
3 0
4 2



-----Note-----

Consider the first sample. The distance between points (0, 1) and (1, 2) equals $\sqrt{2}$, between (0, 1) and (2, 0) — $\sqrt{5}$, between (1, 2) and (2, 0) — $\sqrt{5}$. Thus, these points form a beautiful set. You cannot form a beautiful set with more than three points out of the given points. Note that this is not the only solution.

Difficulty: MEDIUM
Tags: Implementation

Constructive algorithms

Starter code:

Solutions:
(n, m) = map(int, input().split())
l = []
k = min(m, n)
for i in range(k + 1):
	l.append([i, k - i])
print(len(l))
for i in l:
	print(i[0], i[1])


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def in_int():
	return int(input())

def in_list():
	return list(map(int, input().split()))

def in_str():
	s = input()
	return list(s[:len(s) - 1])

def in_ints():
	return map(int, input().split())
mod = 7 + 10 ** 9
(n, m) = in_ints()
xx = 0
yy = 0
print(min(m, n) + 1)
for i in range(min(m, n) + 1):
	print(i, min(m, n) - i)


(n, m) = map(int, input().split())
a = []
i = n
j = 0
while i >= 0 and j <= m and (i + j > 0):
	a.append((i, j))
	i -= 1
	j += 1
print(len(a))
for i in a:
	print(' '.join(map(str, i)))


(m, n) = map(int, input().split())
mini = min(m, n)
print(mini + 1)
i = 0
while i <= mini:
	print(i, mini - i)
	i += 1


n = min(map(int, input().split()))
print(n + 1)
for (x, y) in zip(range(n + 1), range(n, -1, -1)):
	print(x, y)


import sys

def answer(n, m):
	mn = min(n, m)
	print(mn + 1)
	for i in range(mn + 1):
		print(i, mn - i)
	return

def main():
	(n, m) = map(int, sys.stdin.readline().split())
	answer(n, m)
	return
main()


import re, sys, string, operator, functools, fractions, collections
sys.setrecursionlimit(10 ** 7)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
RI = lambda x=' ': list(map(int, input().split(x)))
RS = lambda x=' ': input().rstrip().split(x)
mod = int(1000000000.0 + 7)
eps = 1e-06
(n, m) = RI()
(x, y) = (0, 0)
print(min(n, m) + 1)
if n < m:
	for i in range(n + 1):
		print(i, n - i)
else:
	for i in range(m + 1):
		print(i, m - i)


l1 = input().split()
l1 = [int(i) for i in l1]
l2 = min(l1[0], l1[1])
print(l2 + 1)
for i in range(l2 + 1):
	print(str(i) + ' ' + str(l2 - i))


def main():
	from sys import stdin, stdout
	(m, n) = list(map(int, stdin.readline().split()))
	minim = min(m, n)
	stdout.write(str(minim + 1) + '\n')
	if n == minim:
		for i in range(minim + 1):
			stdout.write(str(m) + ' ' + str(i) + '\n')
			m -= 1
	else:
		for i in range(minim + 1):
			stdout.write(str(i) + ' ' + str(n) + '\n')
			n -= 1

def __starting_point():
	main()
__starting_point()


(n, m) = map(int, input().split())
if n < m:
	print(n + 1)
	for i in range(n + 1):
		print(n - i, i)
else:
	print(m + 1)
	for i in range(m + 1):
		print(m - i, i)


(n, m) = map(int, input().split())
print(min(n + 1, m + 1))
for i in range(min(n + 1, m + 1)):
	print(min(n, m) - i, i)


(a, b) = map(int, input().split())
(a, b) = (max(a, b), min(a, b))
print(b + 1)
for i in range(b + 1):
	print(b - i, i)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
(n, m) = map(int, input().split())
s = set()
for i in range(min(n, m) + 1):
	s.add((i, min(n, m) - i))
print(len(s))
for i in s:
	print(*i)


(n, m) = list(map(int, input().split()))
c = []
g = []
sol = []
for i in range(0, n + 1):
	for j in range(1, m + 1):
		c.append((i, j))
for i in range(1, n + 1):
	c.append((i, 0))
k = 0
j = m
for i in range(min(n, m) + 1):
	sol.append((k, j))
	k += 1
	j -= 1
print(len(sol))
for i in sol:
	print(*i)


import sys
input = sys.stdin.readline
read_tuple = lambda _type: map(_type, input().split(' '))

def solve():
	(x, y) = read_tuple(int)
	_max = min(x, y) + 1
	print(_max)
	if x > y:
		for i in range(_max):
			print(i + 1, i)
	elif x < y:
		for i in range(_max):
			print(i, i + 1)
	else:
		for i in range(_max):
			print(i, y - i)
solve()


(n, m) = map(int, input().split())
t = min(n, m)
print(t + 1)
for x in range(t + 1):
	print(x, t - x)


l = [int(i) for i in input().split()]
n = l[0]
m = l[1]
a = min(n, m)
if a == 0:
	print(1, 0)
else:
	print(a + 1)
	for i in range(a + 1):
		print(a - i, i)


(n, m) = map(int, input().split())
(i, j) = (n, 0)
print(min(n, m) + 1)
while i >= 0 and j <= m:
	print(i, j)
	i -= 1
	j += 1


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
INF = 99999999999999999999999999999999

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		(n, m) = ria()
		k = min(n, m)
		print(k + 1)
		for i in range(k + 1):
			print(i, k - i)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


nums = input().split()
n = int(nums[0])
m = int(nums[1])
k = min(m, n) + 1
print(k)
for i in range(k):
	print(str(i) + ' ' + str(k - 1 - i))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():
	(n, m) = map(lambda x: int(x), input().split())
	(x, y) = (n, 0)
	k = 0
	points = []
	while 0 <= x - k <= n and 0 <= y + k <= m:
		points.append((x - k, y + k))
		k += 1
	print(len(points))
	print('\n'.join(map(lambda point: f'{point[0]} {point[1]}', points)))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
input = lambda : sys.stdin.readline().rstrip('\r\n')

def print(*args, **kwargs):
	sep = kwargs.pop('sep', ' ')
	file = kwargs.pop('file', sys.stdout)
	atStart = True
	for x in args:
		if not atStart:
			file.write(sep)
		file.write(str(x))
		atStart = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
main()


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
(n, m) = map(int, input().split())
p = min(n, m)
print(p + 1)
for i in range(p + 1):
	print(i, p - i)


(n, m) = map(int, input().split())
f = n
if m < f:
	f = m
print(f + 1)
for i in range(0, f + 1):
	print(f - i, i)


def beautiful_sets_of_points(n, m):
	ans = []
	x = 0
	y = m
	while x <= n and y >= 0:
		ans.append((x, y))
		x += 1
		y -= 1
	return ans
(n, m) = map(int, input().strip().split())
ans = beautiful_sets_of_points(n, m)
print(len(ans))
for (x, y) in ans:
	print(x, y)


(x, y) = map(int, input().split())
a = [(i, min(x, y) - i) for i in range(min(x, y) + 1)]
print(len(a))
for i in a:
	print(*i, sep=' ')


(n, m) = [int(x) for x in input().split()]
print(min(n, m) + 1)
for i in range(0, min(m, n) + 1):
	print(i, min(n, m) - i)


import sys
import math as mt
input = sys.stdin.buffer.readline
t = 1
for __ in range(t):
	(n, m) = map(int, input().split())
	(x, y) = (n, 0)
	print(min(n + 1, m + 1))
	n1 = min(n + 1, m + 1)
	for i in range(n1):
		print(x, y)
		x -= 1
		y += 1


(n, m) = [int(x) for x in input().split()]
print(min(n, m) + 1)
s = min(n, m) + 1
if n >= m:
	a = 0
	b = m
	for i in range(s):
		print(a + i, b - i)
else:
	a = 0
	b = n
	for i in range(s):
		print(a + i, b - i)


s = min(map(int, input().split()))
print(s + 1)
for i in range(s + 1):
	print(i, s - i)


from sys import stdin, stdout
from math import sqrt
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, input().split()))
for _ in range(1):
	(n, m) = lst()
	if m < n:
		(m, n) = (n, m)
	l = []
	for i in range(n + 1):
		l += [[i, n - i]]
	print(len(l))
	for (k, v) in l:
		print(k, v)


(n, m) = map(int, input().split())
t = min(n, m) + 1
print(t)
while t:
	print(t - 1, min(n, m) + 1 - t)
	t -= 1


def BeautifulSetsOfpoints(n, m):
	if n < m:
		print(n + 1)
		y = m
		x = 0
		while x <= n:
			print(str(x) + ' ' + str(y))
			x += 1
			y -= 1
	else:
		print(m + 1)
		y = 0
		x = n
		while y <= m:
			print(str(x) + ' ' + str(y))
			x -= 1
			y += 1
(n, m) = [int(x) for x in input().split()]
BeautifulSetsOfpoints(n, m)


(n, m) = map(int, input().split())
k = min(n, m) + 1
l = 0
r = min(n, m)
print(k)
for i in range(k):
	print(l, r)
	l += 1
	r -= 1


h = min([int(x) for x in input().split(' ')])
h += 1
v = [(x, h - x - 1) for x in range(h)]
print(h)
for c in v:
	print(c[0], c[1])


def main():
	(n, m) = [int(i) for i in input().split()]
	ans = []
	k = min(n, m) + 1
	print(k)
	for i in range(k):
		print(i, k - i - 1)
main()


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt, gcd, factorial, pow, pi

def binNumber(n, size=4):
	return bin(n)[2:].zfill(size)

def iar():
	return list(map(int, input().split()))

def ini():
	return int(input())

def isp():
	return map(int, input().split())

def sti():
	return str(input())

def par(a):
	print(' '.join(list(map(str, a))))

def tdl(outerListSize, innerListSize, defaultValue=0):
	return [[defaultValue] * innerListSize for i in range(outerListSize)]

def sts(s):
	s = list(s)
	s.sort()
	return ''.join(s)

class pair:

	def __init__(self, f, s):
		self.fi = f
		self.se = s

	def __lt__(self, other):
		return (self.fi, self.se) < (other.fi, other.se)
(x, y) = isp()
print(min(x, y) + 1)
k = 0
while k <= min(x, y):
	print(k, min(x, y) - k)
	k += 1


a = list(map(int, input().split()))
n = a[0]
m = a[1]
k = min(n, m) + 1
print(k)
for i in range(0, k):
	print(i, end=' ')
	print(k - i - 1)


from sys import *
from math import *
(n, m) = map(int, stdin.readline().split())
x = min(n, m)
j = 0
k = m
ans = []
cnt = 0
for i in range(x + 1):
	x = [j, k]
	ans.append(x)
	cnt += 1
	j += 1
	k -= 1
print(cnt)
for i in range(cnt):
	print(*ans[i])


def prog():
	(n, m) = map(int, input().split())
	if n <= m:
		print(n + 1)
		x = n
		y = 0
		for i in range(n + 1):
			print(x, y)
			x -= 1
			y += 1
	else:
		print(m + 1)
		y = m
		x = 0
		for i in range(m + 1):
			print(x, y)
			y -= 1
			x += 1
prog()


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import Decimal
from decimal import *
from collections import defaultdict, deque
import heapq
getcontext().prec = 25
abcd = 'abcdefghijklmnopqrstuvwxyz'
MOD = pow(10, 9) + 7
BUFSIZE = 8192
from bisect import bisect_left, bisect_right

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split(' '))
ans = []
for i in range(min(n, k) + 1):
	ans.append((i, min(n, k) - i))
print(len(ans))
for i in ans:
	print(*i)


(n, m) = map(int, input().split())
s = min(n, m)
print(s + 1)
for x in range(s + 1):
	if n < m:
		print(x, m - x)
	else:
		print(n - x, x)


(x, y) = [int(i) for i in input().split()]
print(min(x, y) + 1)
for i in range(min(x, y) + 1):
	print(i, min(x, y) - i)


in_ = list(map(int, input().split()))
(n, m) = (in_[0], in_[1])

def perf_sq(list_):
	dist_ = ((list_[0][0] - list_[1][0]) ** 2 + (list_[0][1] - list_[1][1]) ** 2) ** 0.5
	return int(dist_) == dist_
x_true = n <= m
count_ = 1
if x_true:
	ans_ = [[n, 0]]
	count_ = 1
	for i in range(n):
		ans_.append([ans_[-1][0] - 1, ans_[-1][1] + 1])
		count_ += 1
else:
	ans_ = [[0, m]]
	count_ = 1
	for i in range(m):
		ans_.append([ans_[-1][0] + 1, ans_[-1][1] - 1])
		count_ += 1
print(count_)
for i in range(count_):
	print(str(ans_[i][0]) + ' ' + str(ans_[i][1]))


(n, m) = map(int, input().split())
ans = min(m + 1, n + 1)
print(ans)
pt = [0, ans - 1]
for i in range(1, ans + 1):
	prt = ' '.join([str(v) for v in pt])
	print(prt)
	pt[0] += 1
	pt[1] -= 1


(n, m) = map(int, input().split())
k = min(n, m)
ans = k + 1
l = 0
r = k
print(ans)
while l <= k:
	print(l, r)
	l += 1
	r -= 1


import math
(n, m) = list(map(int, input().split()))
print(min(n, m) + 1)
for x in range(min(n, m) + 1):
	print(x, m - x)


(n, m) = map(int, input().split())
a = []
temp = max(n, m)
if n > m:
	for i in range(0, min(n, m) + 1):
		a.append([temp, i])
		temp -= 1
else:
	for i in range(0, min(n, m) + 1):
		a.append([i, temp])
		temp -= 1
print(len(a))
for i in a:
	print(*i)


import math
(orig_n, orig_m) = [int(x) for x in input().split()]
n = min(orig_n, orig_m)
m = max(orig_n, orig_m)
points = [(x, m - x) for x in range(0, n + 1)]
print(len(points))
for point in points:
	(x, y) = point
	if orig_n != n:
		print(f'{y} {x}')
	else:
		print(f'{x} {y}')


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 5
T = 1
for _ in range(T):
	(n, m) = list(map(int, stdin.readline().rstrip().split()))
	mn = min(m, n)
	print(mn + 1)
	for i in range(mn + 1):
		print(i, mn - i)


(a, b) = list(map(int, input().split()))
k = min(a, b)
print(k + 1)
for i in range(k + 1):
	print(i, k - i)


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def MOD():
	return pow(10, 9) + 7

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
n = min(INL())
OPS(n + 1)
for _ in range(n + 1):
	OPL([_, n - _])


from sys import stdin
import math
(n, m) = list(map(int, stdin.readline().split()))
print(min(n, m) + 1)
for i in range(0, min(n, m) + 1):
	print(i, min(n, m) - i)


def solve(n, m):
	minDim = min(n, m)
	size = 1 + minDim
	print(size)
	for x in range(size):
		print(f'{x} {minDim - x}')
(n, m) = map(int, input().split())
solve(n, m)


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
(n, m) = MAP()
k = min(n, m) + 1
print(k)
for i in range(k):
	print(i, k - i - 1)


(n, m) = [int(i) for i in input().split()]
ans = min(n, m)
print(ans + 1)
for i in range(ans + 1):
	print(str(ans - i) + ' ' + str(i))


def dots(n, m):
	a = list()
	for i in range(min(n, m) + 1):
		a.append([i, min(n, m) - i])
	return (min(n, m) + 1, a)
(x, y) = [int(j) for j in input().split()]
print(dots(x, y)[0])
for elem in dots(x, y)[1]:
	print(*elem)


arr = [int(x) for x in input().split()]
(n, m) = (arr[0], arr[1])
mini = min(n, m)
print(mini + 1)
i = 0
while mini >= 0:
	print(mini, i)
	mini -= 1
	i += 1


I = lambda : int(input())
IL = lambda : list(map(int, input().split()))
IF = lambda : list(map(float, input().split()))
(n, m) = IL()
a = min(n, m) + 1
print(a)
for i in range(a):
	print(i, a - 1 - i)


(N, M) = map(int, input().split())
X = min(N, M)
print(X + 1)
for i in range(X + 1):
	print(i, X - i)


(n, m) = list(map(int, input().split()))
minimal = min(n, m)
i = 0
print(minimal + 1)
while i <= minimal:
	print(i, minimal - i)
	i += 1


(n, m) = map(int, input().split())
mini = min(n, m)
print(mini + 1)
current = 0
for i in range(mini, -1, -1):
	print(i, current)
	current += 1


(n, m) = map(int, input().split())
mi = min(n, m)
print(mi + 1)
for j in range(mi + 1):
	print(j, mi - j)


(a, b) = (int(x) for x in input().split())
print(min(a, b) + 1)
for i in range(min(a, b) + 1):
	print(a - i, i)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	(n, m) = LI()
	r = min(n, m) + 1
	rr = []
	for i in range(r):
		rr.append((i, m - i))
	return '{}\n{}'.format(r, JAA(rr, '\n', ' '))
print(main())


(n, m) = [int(k) for k in input().split()]
minimum = min(m, n)
print(minimum + 1)
points = [(0, m)]
x = 0
y = m
done = False
while not done:
	x += 1
	y -= 1
	points.append((x, y))
	if x == n or y == 0:
		done = True
for i in points:
	print(str(i[0]) + ' ' + str(i[1]))


(n, m) = map(int, input().split())
n = min(n, m)
print(n + 1)
for x in range(0, n + 1):
	print(f'{x} {n - x}')


def solve(n, m):
	a = min(n + 1, m + 1)
	print(a)
	for i in range(a):
		print(i, a - 1 - i)
A = list(map(int, input().split()))
solve(A[0], A[1])


params = list(map(int, list(input().split())))
x = params[0]
y = params[1]
if x < y:
	lim = x
else:
	lim = y
print(lim + 1)
for r in range(lim, -1, -1):
	print(str(lim - r) + ' ' + str(r))


(n, m) = map(int, input().split())
ans = []
for i in range(min(n, m) + 1):
	ans.append([i, min(n, m) - i])
print(len(ans))
for i in range(len(ans)):
	print(*ans[i])


(a, b) = map(int, input().split())
print(min(a, b) + 1)
up = max(a, b)
down = 0
for i in range(min(a, b) + 1):
	print(i, min(a, b) - i)


(x, y) = map(int, input().split())
print(min(x, y) + 1)
for i in range(0, min(x, y) + 1):
	print(str(i) + ' ' + str(min(x, y) - i))


(n, m) = map(int, input().split())
p = []
x = min(n, m)
for i in range(x + 1):
	p.append((i, x - i))
print(len(p))
for xx in p:
	print(*xx)


al = input().split()
m = list(map(int, al))
y = min(m[0], m[1])
print(y + 1)
for i in range(y + 1):
	print(i, y - i)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, m) = iia()
num = min(n, m)
print(num + 1)
for i in range(num + 1):
	print(i, num - i)


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
(n, m) = R()
print(min(n, m) + 1)
for i in range(min(n, m) + 1):
	print(i, min(n, m) - i)


tmp = input().split(' ')
n = int(tmp[0])
m = int(tmp[1])
minimum = min(n, m) + 1
print(minimum)
for i in range(minimum):
	print('{} {}'.format(minimum - i - 1, i))


(maxX, maxY) = map(int, input().split())
(x, y) = (0, maxY)
ret = [(x, y)]
while x + 1 <= maxX and y - 1 >= 0:
	x += 1
	y -= 1
	ret.append((x, y))
print('%d\n%s' % (len(ret), '\n'.join(('%d %d' % (x, y) for (x, y) in ret))))


[n, m] = [int(x) for x in input().split()]
s = min(n + 1, m + 1)
print(s)
for i in range(s):
	print(str(s - i - 1) + ' ' + str(i))


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, m) = value()
x = min(n, m)
print(x + 1)
y = m
for i in range(x + 1):
	print(i, y)
	y = y - 1
	if y < 0:
		y = 0


import sys, math
input = sys.stdin.readline

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input().strip()

def listStr():
	return list(input().strip())
import collections as col
import math

def solve():
	(N, M) = getInts()
	ans = min(N, M) + 1
	print(ans)
	(start_x, start_y) = (N, 0)
	while start_x >= 0 and start_y <= M:
		print(start_x, start_y)
		start_x -= 1
		start_y += 1
	return
solve()


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)

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

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

def input():
	return sys.stdin.readline().strip()
(n, m) = get_ints()
y = min(n, m)
x = 0
print(y + 1)
while y >= 0:
	print(x, y)
	x += 1
	y -= 1


x = min(list(map(int, input().split())))
print(x + 1)
for i in range(x + 1):
	print(i, x - i)


entrada = input()
entrada_str = list(entrada.split(' '))
entrada_int = list(map(int, entrada_str))
m = entrada_int[0]
n = entrada_int[1]
min = min(m, n)
min += 1
print(min)
for i in range(min):
	print(i, min - i - 1)


l1 = list(map(int, input().split()))
m = l1[0]
n = l1[1]
ans = min(m, n) + 1
print(ans)
for i in range(ans):
	print(f'{i} {ans - i - 1}')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
(n, m) = L()
if n < m:
	print(n + 1)
	for i in range(n + 1):
		print(n - i, i)
else:
	print(m + 1)
	for i in range(m + 1):
		print(n - i, i)
endtime = time.time()


arr = [int(x) for x in input().split()]
n = arr[0]
m = arr[1]
mi = min(n, m)
print(mi + 1)
for i in range(mi + 1):
	print('{} {}'.format(i, mi - i))


from __future__ import division, print_function
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p1
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph():
	d = {}
	(v, e) = mi()
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(l, n):
	d = {}
	for i in range(1, n + 1):
		if i not in d.keys():
			d[i] = l[i]
		else:
			d[i].append(l[i])
	return d
(n, m) = mi()
print(min(n, m) + 1)
for i in range(min(n, m) + 1):
	print(i, min(n, m) - i)


(n, m) = map(int, input().split())
print(min(n, m) + 1)
(x, y) = (0, m)
while x <= n and y >= 0:
	print(x, y)
	x += 1
	y -= 1


(n, m) = map(int, input().split())
if n > m:
	print(m + 1)
	for i in range(1, m + 2):
		print(i, i - 1)
elif n == m:
	print(m + 1)
	for i in range(0, n + 1):
		print(n - i, i)
else:
	print(n + 1)
	for i in range(0, n + 1):
		print(i, i + 1)


R = lambda : map(int, input().split())
(n, m) = R()
print(min(n, m) + 1)
if n == m:
	for i in range(n + 1):
		print(i, n - i)
elif n < m:
	for i in range(n + 1):
		print(i, i + 1)
else:
	for i in range(m + 1):
		print(i + 1, i)


import math
q = 1
for _ in range(q):
	(n, m) = map(int, input().split())
	if n == m:
		l = []
		for i in range(n + 1):
			l.append([i, n - i])
		print(len(l))
		for i in range(len(l)):
			print(*l[i])
	elif n > m:
		l = []
		for i in range(m + 1):
			l.append([i + 1, i])
		print(len(l))
		for i in range(len(l)):
			print(*l[i])
	else:
		l = []
		for i in range(n + 1):
			l.append([i, i + 1])
		print(len(l))
		for i in range(len(l)):
			print(*l[i])


import sys, math, itertools, random, bisect
from collections import defaultdict
INF = 10 ** 18

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

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

def input():
	return sys.stdin.readline().strip()
mod = 10 ** 9 + 7
test = 1
for _ in range(test):
	(n, m) = get_ints()
	mn = min(n, m)
	print(mn + 1)
	for i in range(mn + 1):
		print(i, mn - i)


import math
import random
(n, m) = map(int, input().split())
n_points = n + 1 if n < m else m + 1
print(n_points)
for a in range(n_points)[::-1]:
	if n > m:
		print(n_points - 1 - a, a)
	else:
		print(a, n_points - 1 - a)


(n, m) = map(int, input().split())
a = min(n, m)
print(a + 1)
b = 0
while b != 1:
	x = [i for i in range(0, a + 1)]
	y = [a - i for i in range(0, a + 1)]
	b += 1
for i in range(a + 1):
	print(x[i], y[i])


import sys
(n, m) = map(int, input().split())
if m > n:
	print(n + 1)
	curr = (0, 1)
	while curr[0] <= n:
		print(curr[0], curr[1])
		curr = (curr[0] + 1, curr[1] + 1)
	sys.exit()
if m == n:
	print(n + 1)
	curr = (0, n)
	while curr[0] <= n:
		print(curr[0], curr[1])
		curr = (curr[0] + 1, curr[1] - 1)
	sys.exit()
print(m + 1)
curr = (1, 0)
while curr[1] <= m:
	print(curr[0], curr[1])
	curr = (curr[0] + 1, curr[1] + 1)


import math
(x, y) = map(int, input().split())
if x == y:
	print(x + 1)
	for i in range(x + 1):
		print(x - i, i)
elif x > y:
	print(y + 1)
	for i in range(y + 1):
		print(i + 1, i)
else:
	print(x + 1)
	for i in range(x + 1):
		print(i, i + 1)


from math import *
(n, m) = map(int, input().split())
nm = min(n, m)
print(nm + 1)
for i in range(nm + 1):
	print(i, nm - i)


import os
import sys

def log(*args, **kwargs):
	if os.environ.get('CODEFR'):
		print(*args, **kwargs)
(n, m) = tuple(map(int, input().split()))
r = min(n + 1, m + 1)
print(r)
for i in range(r):
	print(r - 1 - i, i)


(n, m) = [int(x) for x in input().split(' ')]
no_of_values = min(n, m) + 1
print(no_of_values)
for x in range(no_of_values):
	print(x, no_of_values - x - 1)


(n, m) = map(int, input().split())
x = []
y = []
cnt = 0
for i in range(0, min(n, m) + 1):
	cnt += 1
	x.append(i)
	y.append(min(n, m) - i)
print(cnt)
for i in range(cnt):
	print(x[i], y[i])


import time, math, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

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

def IO():
	return stdin.readline()

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

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

def P(x):
	return stdout.write(str(x))

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count

def solve():
	(n, m) = IP()
	print(min(n, m) + 1)
	(x, y) = (0, m)
	while x <= n and y >= 0:
		print(x, y)
		x += 1
		y -= 1
solve()


I = lambda : list(map(int, input().split()))
(x, y) = I()
k = min(x, y) + 1
print(k)
for i in range(k):
	print(i, k - i - 1)


numbers = input()
(n, m) = numbers.split()
n = int(n)
m = int(m)
minimo = min(n, m)
print(minimo + 1)
for i in range(minimo + 1):
	print(i, minimo - i)


a = input()
li = a.split()
i = 0
while i < len(li):
	li[i] = int(li[i])
	i += 1
c = min(li)
print(c + 1)
i = 0
while i <= c:
	print('%s %s' % (c - i, i))
	i += 1


(n, m) = map(int, input().split())
mini = min(n, m)
lt = [(i, mini - i) for i in range(mini + 1)]
print(len(lt))
for p in lt:
	print(*p)


import collections as cc
import sys
I = lambda : list(map(int, input().split()))
(n, m) = I()
temp = min(n, m)
print(temp + 1)
for i in range(temp + 1):
	print(i, temp - i)


def points(x, y):
	blanck = []
	mini = min(x, y)
	for i in range(0, mini + 1):
		blanck.append([i, mini - i])
	print(len(blanck))
	for i in blanck:
		print(*i)
	return ''
(a, b) = map(int, input().strip().split())
print(points(a, b))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from bisect import bisect_left
from collections import Counter
(n, k) = map(int, input().split())
ans = []
print(min(n, k) + 1)
ans.append((n, 0))
for i in range(0, min(n, k) + 1):
	print(i, min(n, k) - i)


(x, y) = map(int, input().split())
k = 0
s = set([])
for i in range(y, -1, -1):
	if k <= x:
		s.add((k, i))
		k += 1
print(len(s))
for i in list(s):
	print(i[0], i[1])


entrada = input()
n = int(entrada.split()[0])
m = int(entrada.split()[1])
result = m if m < n else n
print(result + 1)
k = result
while k >= 0:
	print(result - k, end=' ')
	print(k)
	k -= 1


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
m = min(RMI())
limit = m + 1
print(limit)
for i in range(limit):
	print(m - i, i)


from math import sqrt
(n, m) = map(int, input().split())

def dist(x1, y1, x2, y2):
	d = (x1 - x2) ** 2 + (y2 - y1) ** 2
	if sqrt(d) != int(sqrt(d)):
		return True
	else:
		return False
z = min(n, m)
print(z + 1)
ans = []
ba = []
if n != m:
	for i in range(z + 1):
		if i != 0:
			ans.append([i, i])
else:
	ans.append([z, 0])
for i in range(n + 1):
	for j in range(m + 1):
		if i != 0 or j != 0:
			ba.append([i, j])
if m != n:
	for i in ba:
		(x, y) = i
		flag = 0
		for j in ans:
			(a, b) = j
			z = dist(x, y, a, b)
			if z == False:
				flag = 1
				break
		if flag == 0:
			ans.append(i)
			break
else:
	for i in ba:
		(x, y) = i
		flag = 0
		for j in ans:
			(a, b) = j
			z = dist(x, y, a, b)
			if z == False:
				flag = 1
				break
		if flag == 0:
			ans.append(i)
for i in range(min(n, m) + 1):
	print(i, min(n, m) - i)


def main():
	n = min(list(map(int, input().split())))
	print(n + 1)
	for (x, y) in zip(list(range(n + 1)), list(range(n, -1, -1))):
		print(x, y)

def __starting_point():
	main()
__starting_point()


(x, y) = map(int, input().strip().split())
z = min(x, y)
print(z + 1)
count = z
if x == 0:
	print(1, 0)
elif y == 0:
	print(0, 1)
else:
	for i in range(z + 1):
		print(count, i)
		count -= 1


inputlist = list(map(int, input().split()))
m = inputlist[0]
n = inputlist[1]
if m <= n:
	count = m + 1
	print(count)
	ypointer = n
	xpointer = 0
	for j in range(count):
		string = ''
		string += str(xpointer)
		string += ' '
		string += str(ypointer)
		print(string)
		ypointer -= 1
		xpointer += 1
else:
	count = n + 1
	print(count)
	ypointer = 0
	xpointer = m
	for j in range(count):
		string = ''
		string += str(xpointer)
		string += ' '
		string += str(ypointer)
		print(string)
		ypointer += 1
		xpointer -= 1


from collections import defaultdict

def main():
	(n, m) = map(int, input().split())
	ans = [(i, min(n, m) - i) for i in range(min(n, m) + 1)]
	print(len(ans))
	for e in ans:
		print(*e)
main()


(n, m) = [int(i) for i in input().split()]
l = []
mi = min(n, m)
print(mi + 1)
if mi == m:
	start = mi
	for i in range(0, mi + 1):
		print(start - i, i)
else:
	for i in range(0, mi + 1):
		print(i, i + 1)


(n, m) = map(int, input().split())
print(min(n, m) + 1)
for i in range(min(n, m) + 1):
	a = [min(n, m) - i, i]
	print(' '.join((str(elem) for elem in a)))


(a, b) = map(int, input().split())
ans = min(a, b) + 1
count = 0
print(ans)
ans -= 1
while ans >= 0:
	print(ans, end=' ')
	print(count)
	count += 1
	ans -= 1


lst = [int(x) for x in input().split(' ')]
min_l = min(lst)
print(min_l + 1)
for i in range(min_l + 1):
	print(i, min_l - i)


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n, m) = I()
x = n
y = 0
l = []
while x >= 0 and y <= m:
	l.append([x, y])
	x -= 1
	y += 1
print(len(l))
for i in l:
	print(*i)


a = list(map(int, input().split()))
a.sort()
m = a[0]
n = a[1]
print(m + 1)
for i in range(m + 1):
	print(m - i, i)


(n, m) = map(int, input().split())
x = min(n, m)
points = []
print(x + 1)
start_x = 0
start_y = x
print(start_x, start_y)
for i in range(x):
	start_x += 1
	start_y -= 1
	print(start_x, start_y)


min = min(map(int, input().split())) + 1
print(min, '\n'.join([str(str(i) + ' ' + str(min - i - 1)) for i in range(min)]), sep='\n')


temparr = input()
temparr = temparr.split()
maxx = int(temparr[0])
maxy = int(temparr[1])
arr = []
curx = maxx
cury = maxy
count = 0
if maxx == 0 and maxy == 0:
	print(0)
elif curx == cury:
	curx = maxx
	cury = 0
	while curx >= 0:
		count += 1
		arr.append((curx, cury))
		curx -= 1
		cury += 1
	print(count)
	for cord in arr:
		strs = str(cord[0]) + ' ' + str(cord[1])
		print(strs)
else:
	while curx >= 0 and cury >= 0:
		if curx == 0 and cury == 0:
			break
		count += 1
		arr.append((curx, cury))
		curx -= 1
		cury -= 1
	print(count)
	for cord in arr:
		strs = str(cord[0]) + ' ' + str(cord[1])
		print(strs)


(n, m) = list(map(int, input().split()))
minu = min(n, m)
L = []
for i in range(minu + 1):
	L.append((i, minu - i))
print(len(L))
for i in range(len(L)):
	print(L[i][0], L[i][1])


import sys
import os
(n, m) = map(int, input().split())
y = min(n, m)
x = 0
print(y + 1)
while y >= 0:
	print(x, y)
	x += 1
	y -= 1


(n, m) = [int(x) for x in input().split()]
l = []
a = 0
b = 1
k = min(n, m)
for i in range(min(n, m) + 1):
	l.append([i, k - i])
print(len(l))
for i in l:
	print(*i)


from math import inf as inf
from math import *
from collections import *
import sys
input = sys.stdin.readline
t = 1
while t:
	t -= 1
	(n, m) = map(int, input().split())
	print(min(n, m) + 1)
	(x, y) = (0, m)
	for i in range(min(n, m) + 1):
		print(x, y)
		x += 1
		y -= 1


import collections
import itertools
from functools import lru_cache
import sys
import math

def helper():
	pass

def is_perfect_square(num):
	sqt = math.sqrt(num)
	return sqt * sqt == num

def solve():
	(n, m) = map(int, input().split(' '))
	print(min(m, n) + 1)
	for i in range(min(m, n) + 1):
		print(i, min(m, n) - i)
t = 1
for _ in range(t):
	solve()


list_a = list(map(int, input().split()))
n = list_a[0]
m = list_a[1]
if m == n:
	x = 0
	y = m
	print(m + 1)
	for numbers in range(m + 1):
		print(str(x + numbers) + ' ' + str(y - numbers))
elif n > m:
	x = 0
	y = m
	print(m + 1)
	for numbers in range(m + 1):
		print(str(x + numbers) + ' ' + str(y - numbers))
else:
	x = n
	y = 0
	print(n + 1)
	for numbers in range(n + 1):
		print(str(x - numbers) + ' ' + str(y + numbers))