#bzoj2552. Zju2253 Fill the Grid

Zju2253 Fill the Grid

Problem Description

Given an m×nm\times n grid, you're required to fill it with the numbers from 11 to m×nm\times n but the following rules should be satisfied:

  1. each number in grid is larger than its above;
  2. 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 2×32\times 3 grid, we have the following solutions:

456  356  256  246  346
123  124  134  135  125

Thus, the sum is 55.

Input Format

Two positive integer m,nm, n per line. Two zeros indicate the end of input.

Output Format

A single integer per line for each case -- the number of distinct solutions.

Sample

2 3
0 0
5

Data scope and agreement

For data of 100%100 \% : 0<m,n<100<m, n<10 .

This question involves multiple sets of data, please complete with 0 0.