시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB97777.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:

  • No two torus cuboids in the set have intersection.
  • The union of all torus cuboids in the set is the whole rectangular parallelepiped of dimensions $A \times B \times C$.

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 1 2 2 2

예제 출력 1

1

예제 입력 2

2 2 2 4 4 4

예제 출력 2

744

예제 입력 3

2 3 4 6 7 8

예제 출력 3

0

예제 입력 4

2 3 4 98 99 100

예제 출력 4

471975164