시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 256 MB | 9 | 7 | 7 | 77.778% |
We have a rectangular parallelepiped of size $A \times B \times C$, divided into $1 \times 1 \times 1$ small cubes. The small cubes have coordinates from $(0, 0, 0)$ through $(A-1, B-1, C-1)$.
Let $p$, $q$ and $r$ be integers. Consider the following set of $abc$ small cubes:
$\{(\ (p + i)~\bmod~A$, $(q + j)~\bmod~B$, $(r + k)~\bmod~C\ )$ $|$ $i$, $j$ and $k$ are integers satisfying $0 \le i <a$, $0 \le j < b$, $0 \le k < c$ $\}$
A set of small cubes that can be expressed in the above format using some integers $p$, $q$ and $r$, is called a \emph{torus cuboid} of size $a \times b \times c$.
Find the number of the sets of torus cuboids of size $a \times b \times c$ that satisfy the following condition:
Since answer may be too big, print it modulo $10^9+7$.
Input is given in the following format:
$a$ $b$ $c$ $A$ $B$ $C$
Print the number of the sets of torus cuboids of size $a \times b \times c$ that satisfy the condition, modulo $10^9+7$.
$1 \le a < A \le 100$, $1 \le b < B \le 100$, $1 \le c < C \le 100$, all input values are integers.
1 1 1 2 2 2
1
2 2 2 4 4 4
744
2 3 4 6 7 8
0
2 3 4 98 99 100
471975164