#arc139c. [arc139_c]One Three Nine

[arc139_c]One Three Nine

Problem Statement

You are given positive integers NN and MM.

Let us call a sequence of pairs of integers ((X1,Y1),(X2,Y2),dots,(XK,YK))((X_1,Y_1),(X_2,Y_2),\\dots,(X_K,Y_K)) wonderful when it satisfies the following.

  • 1leXileN1 \\le X_i \\le N
  • 1leYileM1 \\le Y_i \\le M
  • Xi+3YineqXj+3YjX_i+3Y_i \\neq X_j+3Y_j and 3Xi+Yineq3Xj+Yj3X_i+Y_i \\neq 3X_j+Y_j, if ineqji \\neq j.

Make a wonderful sequence of pairs of integers whose length, KK, is the maximum possible.

Constraints

  • 1leN,Mle1051 \\le N,M \\le 10^5
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

Output

Print your answer in the following format:

KK X1X_1 Y1Y_1 X2X_2 Y2Y_2 vdots\\vdots XKX_K YKY_K

Here, KK should be the maximum possible length of a wonderful sequence of pairs of integers, and ((X1,Y1),(X2,Y2),dots,(XK,YK))((X_1,Y_1),(X_2,Y_2),\\dots,(X_K,Y_K)) should be a wonderful sequence of pairs of integers. If multiple solutions exist, printing any of them is accepted.


Sample Input 1

3 4

Sample Output 1

10
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
3 4

For N=3,M=4N=3, M=4, there is no wonderful sequence of pairs of integers whose length is 1111 or longer, and the above sequence of pairs of integers is wonderful, so this output is valid.