Problem: 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:

  1. The coordinates of each point in the set are integers. 
  2. 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 <image>, between (0, 1) and (2, 0) — <image>, between (1, 2) and (2, 0) — <image>. 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.

Solution (in JAVA):

Solution:
		import java.io.*;
		import java.util.*;
		
		public class byo {
			static long gcd(long a, long b) {
		
				if (b == 0)
					return a;
				return gcd(b, a % b);
			}
			static char addc(char a,char b) {
				int x=Integer.parseInt(a+"");
				int y=Integer.parseInt(b+"");
				int z=x+y;
				if(z<=9) {
					return (char)('0'+z);
				}
				z=z%10;
				return (char)('0'+z);
			}
			static String add(String a,String b) {
				String r="";
				if(a.length()>=b.length()) {
					int ai=a.length()-1;int bi=b.length()-1;
					while(bi>=0) {
						char c=addc(a.charAt(ai),b.charAt(bi));
						ai--;bi--;
						
						r=c+r;
					}
					while(ai>=0) {
						r=a.charAt(ai)+r;ai--;
					}
				}
				else {
					int ai=a.length()-1;int bi=b.length()-1;
					while(ai>=0) {
						char c=addc(a.charAt(ai),b.charAt(bi));
						ai--;bi--;
						
						r=c+r;
					}
					while(bi>=0) {
						r=b.charAt(bi)+r;bi--;
					}
				}
				
				String f="";
				int o=0;
				while(o<r.length() && r.charAt(o)=='0') {
					o++;
				}
				while(o<r.length()) {
					f+=r.charAt(o);o++;
				}
				if(f.length()==0)return "0";
				return f;
			}
			static long sub(String b,boolean flag) {
				StringBuilder re=new StringBuilder();
				for(int i=0;i<b.length();i++) {
					if(b.charAt(i)=='0') {
						if(re.length()==0)continue;
						re.append('0');
					}
					else {
						re.append((char)('9'+'1'-b.charAt(i)));
					}
				}
				if(re.length()==0) {
					return 0;
				}
				if(flag) {
					StringBuilder o=new StringBuilder();
					for(int i=0;i<re.length();i++) {
						if(re.charAt(i)=='0') {
							o.append('9');
						}
						else
							if(re.charAt(i)=='1' && o.length()==0) {
								continue;
							}
							else
								o.append((char)(re.charAt(i)-1));
					}
					if(o.length()==0) {
						return 0;
					}
					return Long.parseLong(o.toString());
				}
				return Long.parseLong(re.toString());
			}
			static int m;static int n;
			static int[]dx= {0,1,-1,0};
			static int[]dy= {1,0,0,-1};	
			static int[][]in;
			static boolean isv(int i,int j) {
				if(i>=0 && i<n && j>=0 && j<m)return true;
				return false;
			}
			static boolean[]v;
			static boolean yes=true;
			static int[]values;
			static void dfs(int i,int kd) {
				v[i]=true;
				values[i]=kd;
				for(int j:adj[i]) {
					int newval=(kd+1)%k;
					if(!v[j]) {
						dfs(j,newval);
					}
					else {
						if(values[i]==values[j]) {
							yes=false;return;
						}
					}
				}
			}
			static int k;
		    public static void main(String[] args) throws Exception{
		        MScanner sc = new MScanner(System.in);
		        PrintWriter pw = new PrintWriter(System.out);
		        int n=sc.nextInt();int m=sc.nextInt();
		        int start=Math.min(n,m);
		        int zz=0;
		        pw.println(start+1);
		        while(start>=0) {
		        	pw.println((start--)+" "+(zz++));
		        }
		        pw.flush();
		    }
		    static int INF=(int)1e9;
		    
		    static LinkedList<Integer>adj[];
		    static int[] dist = new int[1000000];
		    /*static int dijkstra(int S, int T)	//O(E log E)
			{
				Arrays.fill(dist, INF);
				PriorityQueue<Edge> pq = new PriorityQueue<Edge>();
				dist[S] = 0;
				pq.add(new Edge(S, 0));						//may add more in case of MSSP (Mult-Source)
				while(!pq.isEmpty())
				{
					Edge cur = pq.remove();
					if(cur.node == T)						//remove if all computations are needed
						return dist[T];
					if(cur.cost > dist[cur.node])			//lazy deletion
						continue;
					for(Edge nxt: adjList[cur.node])
						if(cur.cost + nxt.cost < dist[nxt.node])
							pq.add(new Edge(nxt.node, dist[nxt.node] = cur.cost + nxt.cost ));
				}
				return -1;
			}*/
		    static class tri implements Comparable<tri>{
		    	int x;int y;
		    	tri(int a,int b){
		    		x=a;y=b;
		    	}
				@Override
				public int compareTo(tri o) {
					if(x!=o.x) {
						return x-o.x;
					}
						return y-o.y;
					
				}
				public String toString() {
					return "("+x+" "+y+")";
				}
		    }
		    static class Edge implements Comparable<Edge>{
		    	int node;int cost;
		    	Edge(int a,int b){
		    		node=a;cost=b;
		    	}
				@Override
				public int compareTo(Edge o) {
					if(cost!=o.cost) {
						return cost-o.cost;
					}
						return node-o.node;
					
				}
				public String toString() {
					return "("+node+" "+cost+")";
				}
		    }
		    static class MScanner {
		        StringTokenizer st;
		        BufferedReader br;
		
		        public MScanner(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();
		        }
		
		    }
		}