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.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.util.InputMismatchException;

/**
 * Actual solution is at the top
 * 
 * @author Fabian Conejo (FabianConP)
 */

public class _190_A_Ciel_and_Dancing {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		Ciel_and_dancing solver = new Ciel_and_dancing();
		solver.solve(1, in, out);
		out.close();
	}
}

class Ciel_and_dancing {

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		int boys = in.readInt(), girls = in.readInt();
		// Arreglos para saber si x niño o niña ha bailado
		boolean[] b = new boolean[boys];
		boolean[] g = new boolean[girls];
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < b.length; i++) {
			if (i == 0) //El primero se baila a todas :P
				for (int j = 0; j < g.length; j++) {
					// Si el niño o niña nunca ha bailado
					if (!b[i] || !g[j]) {
						// El niño y niña i,j han bailado
						b[i] = g[j] = true;
						// "Imprime a los que bailan"
						sb.append((i + 1) + " " + (j + 1) + "\n");
					}
				}
			else //Como todas bailadas entonces bailan 1
				sb.append((i + 1) + " " + 1 + "\n");

		}
		out.printLine(girls+boys-1);
		out.print(sb);
	}
}

class InputReader {
	private boolean finished = false;

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;

	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 peek() {
		if (numChars == -1)
			return -1;
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				return -1;
			}
			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 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 String readString() {
		int length = readInt();
		if (length < 0)
			return null;
		StringBuilder result = new StringBuilder(length);
		for (int i = 0; i < length; i++)
			result.appendCodePoint(read());
		return result.toString();
	}

	public static boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private String readLine0() {
		StringBuffer buf = new StringBuffer();
		int c = read();
		while (c != '\n' && c != -1) {
			if (c != '\r')
				buf.appendCodePoint(c);
			c = read();
		}
		return buf.toString();
	}

	public String readLine() {
		String s = readLine0();
		while (s.trim().length() == 0)
			s = readLine0();
		return s;
	}

	public String readLine(boolean ignoreEmptyLines) {
		if (ignoreEmptyLines)
			return readLine();
		else
			return readLine0();
	}

	public BigInteger readBigInteger() {
		try {
			return new BigInteger(readString());
		} catch (NumberFormatException e) {
			throw new InputMismatchException();
		}
	}

	public char readCharacter() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		return (char) c;
	}

	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 boolean isExhausted() {
		int value;
		while (isSpaceChar(value = peek()) && value != -1)
			read();
		return value == -1;
	}

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

	public boolean readBoolean() {
		return readInt() == 1;
	}

	public <E extends Enum<E>> E readEnum(Class<E> c) {
		String name = readString();
		if (name == null)
			return null;
		for (E e : c.getEnumConstants()) {
			if (e.name().equals(name))
				return e;
		}
		throw new EnumConstantNotPresentException(c, name);
	}
}

class OutputWriter {
	private final OutputStream out;

	public OutputWriter(OutputStream outputStream) {
		out = outputStream;
	}

	public void print(Object... objects) {
		try {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					out.write(' ');
				out.write(objects[i].toString().getBytes());
			}
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	public void printLine(Object... objects) {
		print(objects);
		try {
			out.write('\n');
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	public void close() {
		try {
			out.close();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	public void flush() {
		try {
			out.flush();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	public void printString(String s) {
		if (s == null)
			printLine(-1);
		else
			printLine(s.length(), s);
	}

	public void printBoolean(boolean b) {
		printLine(b ? 1 : 0);
	}

	public void printEnum(Enum e) {
		printString(e == null ? null : e.name());
	}
}