Given an grid, you're required to fill it with the numbers from to but the following rules should be satisfied:
each number in grid is larger than its above;
each number in grid is larger than its left.
Now, I wonder how many distinct solutions I could make on a grid.
For example. Consider such a grid, we have the following solutions:
123 124 134 135 125
456 356 256 246 346
Thus, the sum is .
输入格式
Two positive integer per line. Two zeros indicate the end of input.
输出格式
A single integer per line for each case -- the number of distinct solutions.