{"raw_statement":[{"iden":"problem statement","content":"You are given positive integers $N$ and $M$.\nLet us call a sequence of pairs of integers $((X_1,Y_1),(X_2,Y_2),\\dots,(X_K,Y_K))$ **wonderful** when it satisfies the following.\n\n*   $1 \\le X_i \\le N$\n*   $1 \\le Y_i \\le M$\n*   $X_i+3Y_i \\neq X_j+3Y_j$ and $3X_i+Y_i \\neq 3X_j+Y_j$, if $i \\neq j$.\n\nMake a wonderful sequence of pairs of integers whose length, $K$, is the maximum possible."},{"iden":"constraints","content":"*   $1 \\le N,M \\le 10^5$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$"},{"iden":"sample input 1","content":"3 4"},{"iden":"sample output 1","content":"10\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n3 4\n\nFor $N=3, M=4$, there is no wonderful sequence of pairs of integers whose length is $11$ or longer, and the above sequence of pairs of integers is wonderful, so this output is valid."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}