There are two arrays of cells: A and B. They have a different size (size A is 7 by n, size B is 3 by m).
It is nessesary to form all sets of cells, each of which contains exactly one cell from each column of A and one cell from each column of B.
Thus, in each set we have n+m cells.
The total quantity of sets is: 7^n*3^m.
But how to get them?