Score : $300$ points
You are given six integers: $h_1, h_2, h_3, w_1, w_2$, and $w_3$.
Consider writing a positive integer on each square of a $3 \times 3$ grid so that all of the following conditions are satisfied:
For example, if $(h_1, h_2, h_3) = (5, 13, 10)$ and $(w_1, w_2, w_3) = (6, 13, 9)$, then all of the following three ways satisfy the conditions. (There are other ways to satisfy the conditions.)
How many ways are there to write numbers to satisfy the conditions?
Input is given from Standard Input in the following format:
$h_1$ $h_2$ $h_3$ $w_1$ $w_2$ $w_3$
Print the number of ways to write numbers to satisfy the conditions.
3 4 6 3 3 7
1
The following is the only way to satisfy the conditions. Thus, $1$ should be printed.
3 4 5 6 7 8
0
There may not be a way to satisfy the conditions.
5 13 10 6 13 9
120
20 25 30 22 29 24
30613