Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special rule:  either the boy in the dancing pair must dance for the first time (so, he didn't dance with anyone before);  or the girl in the dancing pair must dance for the first time. 

Help Fox Ciel to make a schedule that they can dance as many songs as possible.


-----Input-----

The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of boys and girls in the dancing room.


-----Output-----

In the first line print k — the number of songs during which they can dance. Then in the following k lines, print the indexes of boys and girls dancing during songs chronologically. You can assume that the boys are indexed from 1 to n, and the girls are indexed from 1 to m.


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

Output
2
1 1
2 1

Input
2 2

Output
3
1 1
1 2
2 2



-----Note-----

In test case 1, there are 2 boys and 1 girl. We can have 2 dances: the 1st boy and 1st girl (during the first song), the 2nd boy and 1st girl (during the second song).

And in test case 2, we have 2 boys with 2 girls, the answer is 3.

Difficulty: interview

Starter code:

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

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

boys,girls=input().split()

boys=int(boys)
girls=int(girls)

print(boys+girls-1)

for i in range(1,girls+1):
    print(1,i)

for i in range(2,boys+1):
    print(i,girls)



def Comp(n,m):
    count = n+m-1
    print(str(count))
    print("1 1")
    for i in range(2,m+1):
        print("1 "+str(i))
    for i in range(2,n+1):
        print(str(i)+" 1")


Comp(*list(map(int,input().split())))


import sys

got = list(map(int, input().split()))
boys = got[0]
girls = got[1]
sys.stdout.write(str(boys + girls -1) + "\n")
for i in range(1, girls+1):
    sys.stdout.write("1 " + str(i) + "\n")
for i in range(2, boys + 1):
    sys.stdout.write(str(i) + " 1\n")


n,m = map(int,input().split())
ii = set()
jj = set()

ans = []
for i in range(1,n+1):
    for j in range(1,m+1):
        if i not in ii or j not in jj:
            ans.append ((i,j))
            ii.add(i)
            jj.add(j)
print(len(ans))
for a,b in ans:
    print(a,b)

boys, girls = list(map(int,input().split()))
h = 1
i = 1
print(boys + girls -1)
while h <= boys:
    while i <= girls:
        print(h, i)
        i += 1
    h += 1
    if h > boys:
        break
    print(h, i-1)



def main():
        nm=input().split(" ")
        n=int(nm[0])
        m=int(nm[1])
        nos=0
        pairs=[]
        for i in range(1):
                for j in range(m):
                        pairs.append([i+1,j+1]);
                        nos+=1
        for j in range(1,n):
                pairs.append([j+1,1])
                nos+=1
        print (nos)
        for i in pairs:
                pair=str(i[0])+" "+str(i[1])
                print (pair)
def __starting_point(): main()


__starting_point()

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


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


n, m = list(map(int, input().split()))
print(n + m - 1)

for i in range(1, m + 1):
    print(1, i)

for i in range(2, n + 1):
    print(i, 1)


input_list = [int(i) for i in input().split()]
n = input_list[0]
m = input_list[1]

print(n+m-1)
for i in range(1,m+1):
    print(1, i)
for i in range(2,n+1):
    print(i, m)


n,m = list(map (int, input().split()))
print(n+m-1)
boys = list (range (1, n+1))
girls = list (range (1, m+1))
path = list (zip (boys, girls))
path += list (zip (boys, girls[1:]))
if n < m:
  path += [(n,i) for i in girls[n+1:]]
else:
  path += [(i,m) for i in boys[m:]]
path.sort()
for x,y in path:
  print(x,y)


def main():
  x,y = map(int,input().split())
  cx = [0]*x
  cy = [0]*y
  
  print(x+y-1)
  for i in range(x):
    for j in range(y):
      if cx[i] == 0 or cy[j] == 0:
        print(i+1,j+1)
        cx[i] = 1
        cy[j] = 1
  
main()

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

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


def takeinput():
    b,g = list(map(int,input().split()))
    boy = [0]*b
    girl = [0]*g
    ans = [] 
    sum = -1
    for i in range(b):
        for j in range(g):
            if boy[i]==0 or girl[j]==0:
                temp = i+j
                if temp>sum:
                    boy[i]=1
                    girl[j]=1
                    sum=temp
                    ans.append((i+1,j+1))
    return ans

def __starting_point():
    res = takeinput()
    print(len(res))
    for val in res:
        print(val[0],val[1])


__starting_point()

n,m = list(map(int, input().split()))

print(n + m - 1)
for i in range(m):
  print("1 " + str(i + 1))
for i in range(1, n):
  print(str(i + 1) + " 1")


a = list(map(int, input().split()))
b = [False for i in range(0, 101)]
f = [False for i in range(0, 101)]
sol = []

for i in range(1, a[0]+1):
    for j in range(1, a[1]+1):
        if not b[i] or not f[j]:
            b[i] = True
            f[j] = True
            sol.append((i,j))

print(len(sol))
for x in sol:
    print("%i %i" % x)


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


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

__author__ = 'Ol4a'
m, d = list(map(int, input().split()))
k=m+d-1
print(k)
for i in range(1, d+1):
    print(1, i)
for j in range(2, m+1):
    print(j, 1)








n, m = list(map(int, input().split()))

print(n + m - 1)

for i in range(n):
    print(i + 1, 1)
    
for i in range(1, m):
    print(1, i + 1)


import sys

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

print(m+n-1)

for i in range(1, m+1):
    print(i, 1)

for i in range(2, n+1):
    print(1, i)


n, m = list(map(int, input().split()))

print(n + m - 1)

for i in range(n):
    print(i + 1, 1)

for j in range(1, m, 1):
    print(1, j + 1)