Barr the Bear is a bear. Not just any bear. But an IMMBBAAARRR one!
And he knows that randomly foraging for free food in the forest is very tiring and not very healthy too. He has thought of a wonderful solution: he can plant his own trees!!
Barr the Bear has won a plot of land in a lottery (Yes, he is a lucky bear). These plots of land are arranged in R rows, with C plots of land in each row (1 ≤ R, C ≤ 1,000). Barr the Bear has decided that he will plant fruit trees on his farmland. That way, he can get free food from his garden without worrying about tiring work and thus will be able to hibernate in winter with a full stomach.
Being a mathematical bear, the heights of Barr the Bear's trees form a nice pattern: the height of each tree is
unique and and ranges from 1 to R*C. Also, Barr the Bear has realised something: he can get the most
fruits if the heights of the trees in adjacent squares (this means horizontally or vertically adjacent, not diagonally) differ strictly more than 1. Barr the Bear wants to have so many fruits that they will fill up his fat silver platter. Therefore, he decided to plant his trees following this arrangement pattern.
Barr the Bear has decided that this is a trivial problem. However, he is lazy as usual, and thus demanded that you solve the problem for him. Can you help him solve it? If you do, you might get some free food.
Input
Input consists of 2 integers, R and C respectively, on a single line.
Output
Output R rows of C integers such that adjacent numbers differ strictly more than 1. Numbers on the same line should be separated by a single space.
If there exists multiple solutions, output any solution.
If no solution exists, output on a single line the number -1.
Sample Input 1
2 3
Sample Output 1
3 6 2
5 1 4
Sample Input 2
2 1
Sample Ouput 2
-1