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.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;

public class P322A {
    //static long mod=1000000007;
    
    public static void main(String[] args) throws Exception{            
         InputReader in = new InputReader(System.in);       
        PrintWriter pw=new PrintWriter(System.out);   
        
        //int t=in.readInt();
        //  while(t-->0)
            //{
            int m=in.readInt();
            int n=in.readInt();
            int t=n+m-1;
                pw.println(t);
            for(int i=1;i<=n;i++)
                pw.println(1+" "+i);
            for(int i=2;i<=m;i++)
                pw.println(i+" "+1);
        
        
        pw.close();
    }
    
    static BigInteger ways(int N,  int K) {
        BigInteger ret = BigInteger.ONE;
        for(int i=N;i>=N-K+1;i--)
        {
             ret = ret.multiply(BigInteger.valueOf(i));
            
        }
        for (int j = 1; j<=K; j++) {
            ret = ret.divide(BigInteger.valueOf(j));
        }
       
            ret=ret.mod(BigInteger.valueOf(1000000007));
        
        return ret;
    }
    public static long  InverseEuler(long n, long MOD)
    {
        return pow(n,MOD-2,MOD);
    }
     
    public static long  ways(int n, int r, long MOD)
    {
      //  vector<long long> f(n + 1,1);
        long f[]=new long[n+1];
        Arrays.fill(f,1);
        for (int i=2; i<=n;i++)
            f[i]= (f[i-1]*i) % MOD;
        return (f[n]*((InverseEuler(f[r], MOD) * InverseEuler(f[n-r], MOD)) % MOD)) % MOD;
    }
    public static int prime(int n)
    {
        int f=1;
        if(n==1)
            return 0;
        for(int i=2;i<=(Math.sqrt(n));)
        {
            if(n%i==0)
            {
                f=0;
                break;
            }
            if(i==2)
                i++;
            else
                i+=2;
        }
        if(f==1)
            return 1;
        else 
            return 0;
    }
     static void permutations(int n) {
        int[] p = new int[n];
        for (int index = 0; index < n; ++index) {
            p[index] = index + 1;
        }

        while (true) {
            System.out.println(Arrays.toString(p));

            int k = n - 1;
            while (k > 0) {
                if (p[k] < p[k - 1]) {
                    k--;
                }
                else {
                    break;
                }
            }
            if (k == 0) {
                break;
            }
            int j = n - 1;
            while (p[j] < p[k - 1]) {
                j--;
            }

            int t = p[j];
            p[j] = p[k - 1];
            p[k - 1] = t;

            int i = 0;
            while (k + i < n - 1 - i) {
                t = p[k + i];
                p[k + i] = p[n - i - 1];
                p[n - i - 1] = t;
                i++;
            }
        }
    }
    static boolean isPrime(int number) {
        if (number <= 1) {
            return false;
        }
        if (number <= 3) {
            return true;
        }
        if (number % 2 == 0 || number % 3 == 0) {
            return false;
        }
        int i = 5;
        while (i * i <= number) {
            if (number % i == 0 || number % (i + 2) == 0) {
                return false;
            }
            i += 6;
        }
        return true;
    }
public static long gcd(long x,long y)
{
    if(x%y==0)
        return y;
    else return gcd(y,x%y);
}
    public static BigInteger fact(int n)
    {
        BigInteger f=BigInteger.ONE;
        for(int i=1;i<=n;i++)
        {
            f=f.multiply(BigInteger.valueOf(i));
        }
        //f=f.mod(BigInteger.valueOf(m));
        return f;
    }
public static int gcd(int x,int y)
{
    if(x%y==0)
        return y;
    else return gcd(y,x%y);
}
public static int max(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}
public static int min(int a,int b)
{
    if(a>b)
        return b;
    else 
        return a;
}
public static long max(long a,long b)
{
    if(a>b)
        return a;
    else
        return b;
}
public static long min(long a,long b)
{
    if(a>b)
        return b;
    else 
        return a;
}
public static long pow(long n,long p,long m)
{
     long  result = 1;
      if(p==0)
        return 1;
    if (p==1)
        return n;
    while(p!=0)
    {
        if(p%2==1)
            result *= n;
        if(result>m)
        result%=m;
        p >>=1;
        n*=n;
        if(n>m)
        n%=m;
    }
    return result;
}
static long ncr(long n,long k)
{
    long w=1;
    for(long i=n,j=1;i>=n-k+1;i--,j++)
    {
        w=w*i;
        w=w/j;
        w%=1000000007;
        
    }
    return w;
}
static class Pair implements Comparable<Pair>
{
    int a,b;
    Pair (int a,int b)
    {
        this.a=a;
        this.b=b;
    }

    public int compareTo(Pair o) {
        // TODO Auto-generated method stub
        if(this.a!=o.a)
        return Integer.compare(this.a,o.a);
        else
            return Integer.compare(this.b, o.b);
        //return 0;
    }
} 
    
    
    
    
   static  class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

     static class OutputWriter
    {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream)
        {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects)
        {
            for (int i = 0; i < objects.length; i++)
            {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects)
        {
            print(objects);
            writer.println();
        }

        public void close()
        {
            writer.close();
        }

        public void flush()
        {
            writer.flush();
        }

    }
    /* USAGE

    //initialize
        InputReader in      = new InputReader(System.in);
        OutputWriter out    =   new OutputWriter(System.out);

    //read int
    int i = in.readInt();
    //read string
    String s = in.readString();
    //read int array of size N
    int[] x = IOUtils.readIntArray(in,N);
    //printline
    out.printLine("X");


    //flush output
    out.flush();

    //remember to close the
    //outputstream, at the end
    out.close();

    */
  static   class IOUtils {

        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
                array[i] = in.readInt();
            return array;
    }
    }
//BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    //StringBuilder sb=new StringBuilder("");
     //InputReader in = new InputReader(System.in);
  // OutputWriter out = new OutputWriter(System.out);
    //PrintWriter pw=new PrintWriter(System.out);
    //String line=br.readLine().trim();
            
    //int t=Integer.parseInt(br.readLine());
  //    while(t-->0)
    //{
    //int n=Integer.parseInt(br.readLine());
    //long n=Long.parseLong(br.readLine());
    //String l[]=br.readLine().split(" ");
  //int m=Integer.parseInt(l[0]);
    //int k=Integer.parseInt(l[1]);
    //String l[]=br.readLine().split(" ");
    //l=br.readLine().split(" ");
    /*int a[]=new int[n];
    for(int i=0;i<n;i++)
    {
        a[i]=Integer.parseInt(l[i]);
    }*/
       //System.out.println(" ");           
    
    //}
}
