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.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.util.*;


public class Soly
{
    static final int INF = Integer.MAX_VALUE;

    static void mergeSort(int[] a,int [] c, int b, int e)
    {
        if(b < e)
        {
            int q = (b + e) >>1;
            mergeSort(a,c, b, q);
            mergeSort(a, c,q + 1, e);
            merge(a,c, b, q, e);
        }
    }


    static void merge(int[] a,int[]c, int b, int mid, int e)
    {
        int n1 = mid - b + 1;
        int n2 = e - mid;
        int[] L = new int[n1+1], R = new int[n2+1];
        int[] L1 = new int[n1+1], R1 = new int[n2+1];

        for(int i = 0; i < n1; i++) {
            L[i] = a[b + i];
            L1[i] = c[b + i];
        }
        for(int i = 0; i < n2; i++)  {
            R[i] = a[mid + 1 + i];
            R1[i] = c[mid + 1 + i];
        }
        L[n1] = R[n2] = INF;

        for(int k = b, i = 0, j = 0; k <= e; k++)
            if(L[i] <= R[j]){
                a[k] = L[i];
                c[k] = L1[i++];
            }

            else
            {
                a[k] = R[j];
                c[k] = R1[j++];
            }
    }
    static int s;
            static Stack<Character> sta;
static int type(char[] a){
        sta= new Stack<>();
        s=0;
        int op=0,cl=0;
    for (int i = 0; i < a.length; i++) {
        if (a[i]==')'){
            if (!sta.isEmpty()&&sta.peek()=='('){
                op--;
                sta.pop();
            }
            else{
                cl++;
                sta.push(')');
            }
        }
        else{
            op++;
           sta.push('(');
        }
    }
    if (sta.isEmpty())return 0;
    else{
        s=sta.size();
        //1 --> closing
        //2 -->opening
        if (op>0&&cl>0)return 50;
        else{
            if (op>0)return 2;
            return 1;
        }

    }
}



    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        try (PrintWriter or = new PrintWriter(System.out)) {

           int n = in.nextInt(),m=in.nextInt();
           boolean[] nn= new boolean[n],mm=new boolean[m];
          List<coooo>a= new ArrayList<>();
            for (int i = 0; i <n; i++) {
                for (int j = 0; j < m; j++) {
                    if (!nn[i]||!mm[j]){
                        a.add(new coooo(i+1,j+1));
                        nn[i]=true;
                        mm[j]=true;
                    }
                }
            }
            or.println(a.size());
            for (coooo i:a) {
                or.println(i.x+" "+i.y);
            }

        }
        }











    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }



}
class coooo implements Comparable<coooo> {
    int x,y;

    public coooo(int x, int y) {
        this.x = x;
        this.y = y;
        //this.ind = ind;
    }

    @Override
    public int compareTo(coooo o) {
        if (x!=o.x)return x-o.x;
        return y-o.y;
    }
}