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.
from typing import List


class Solution:
    def main(self):
        # l = []
        # l = input()
        # n = int(l[0])
        # k = int(l[-1])
        # l = []
        # l = input()
        # l = l.split()
        # answer = self.next_round(n,k, l)
        # answer = self.a_bit_plusplus()
        # answer = self.petya_and_strings()
        # answer = self.beautiful_matrix()
        # answer = self.young_physicist()
        answer = 0
        self.ciel_and_dancing()
        return answer
    
    def watermelon(self,n: int) -> int:
        return (n % 2 == 0 and n!=2)
    
    def way_too_long_words(self,n: int, s: List[str]) -> List[str]:
        ret_list = []
        for i in range(n):
            cur = s[i]
            ret = ""
            if(len(s[i]) <= 10):
                ret_list.append(cur)
            else:
                ret += cur[0]
                ret += str(len(cur[1:len(cur)-1]))
                ret += cur[-1]
                ret_list.append(ret)
        return ret_list
    
    def a_team(self, n: int, list: List[List[int]]) -> List[List[int]]:
        ret_list = 0
        for i in range(n):
            current = list[i]
            ret = int(current[0]) ^ int(current[1]) ^ int(current[2])
            if(current[0] == current[1] and current[1] ==  current[2] and current[0] == 1):
                ret = 0
            elif(current[0] == current[1] and current[1] ==  current[2] and current[0] == 0):
                ret = 1
            if(ret == 0):
                ret_list += 1
        return ret_list
    
    def next_round(self, n: int, k: int, list:List[int]) -> int:
        ret = 0;
        print("length: "+str(len(list)))
        for i in range(len(list)):
            if(int(list[i]) >= int(list[k-1]) and int(list[i]) >= 1):
                ret += 1
        return ret
    
    def a_bit_plusplus(self):
        n = int(input())
        x = 0
        while(n > 0):
            str = input()
            if("+" in str):
                x += 1
            else:
                x -= 1
            n -= 1
        return x
    
    def petya_and_strings(self):
        str1 = input()
        str2 = input()
        length = len(str1)
        i = 0
        str1 = str1.lower()
        str2 = str2.lower()
        isDone = False
        ret = 0
        while(i < length and isDone == False):
            if(str1[i] < str2[i]):
                isDone = True
                ret = -1
            elif(str1[i] > str2[i]):
                isDone = True
                ret = 1
            i += 1
        return ret
    
    def beautiful_matrix(self):
        i = 5
        matrix = []
        while(i>0):
            matrix.append(input().replace(" ", ""))
            i -= 1
        for k in range(0,5):
            for j in range(0,5):
                if(matrix[k][j] == "1"):
                    ret = abs(j-2) + abs(k-2)
                    break
        return ret

    def helpful_maths(self):
        stri = input()
        splitt = stri.split("+")
        for i in range(len(splitt)):
            splitt[i] = int(splitt[i])
        splitt = sorted(splitt, key=lambda x: x)
        ret = ""
        for i in range(len(splitt)):
            x = str(splitt[i])
            if(i == len(splitt) - 1):
                ret += ""+x
            else:
                ret += ""+x+"+"
        return ret

    def word_capitalization(self):
        s = input()
        ret = ""
        ret += s[0].upper() + s[1:]
        return ret

    def stones_on_the_table(self):
        count = 0
        n = int(input())
        s = input()
        for i in range(1,len(s)):
            if(s[i] == s[i-1]):
                count += 1
        return count

    def boy_or_girl(self):
        ret = "CHAT WITH HER!"
        s = input()
        sett = set()
        count = 0
        for i in range(len(s)):
            if(s[i] not in sett):
                count += 1
                sett.add(s[i])
        if(count % 2 != 0):
            ret = "IGNORE HIM!"
        return ret

    def football(self):
        ret = "NO"
        i = 0
        j = 0
        s = input()
        for k in range(len(s)):
            if(s[k] == s[j]):
                i += 1
            else:
                j = k
                i = k
            if(i-j == 6):
                ret = "YES"
                break
        return ret

    def hq9_plus(self):
        ret = "NO"
        s = input()
        n = len(s)
        sett = set(['H', 'Q', '9'])
        for i in range(n):
            if(s[i] in sett):
                ret = "YES"
                break
        return ret

    def even_odds(self):
        ret = 0
        s = input()
        n, k = s.split(" ")
        n, k = int(n), int(k)
        if (k <= (n + 1) // 2):
            ret = k * 2 - 1
        else:
            ret = (k - (n + 1) // 2) * 2
        return int(ret)
    
    def string_task(self):
        ret = ""
        s = input()
        n = len(s)
        s = s.lower()
        vowels = set(['a','e','i','o','u','y','A','E','I','O','U','Y'])
        for i in range(n):
            if(s[i] not in vowels):
                ret += "." + s[i]
        return ret
    
    def young_physicist(self):
        ret = "NO"
        n = int(input())
        i = n
        a = []
        x,y,z = 0,0,0
        while(i > 0):
            s = input()
            a = s.split(" ")
            a[0], a[1], a[2] = int(a[0]), int(a[1]), int(a[2])
            x += a[0]
            y += a[1]
            z += a[2]
            i -= 1
        if(x==y and y==z and x==0):
            ret = "YES"
        return ret

    def ciel_and_dancing(self):
        s = input()
        n, m = s.split(" ")
        n,m = int(n), int(m)
        print(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")

x = Solution()
answer = x.main()
# print(answer)