시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB11101090.909%

문제

Alice and Bob will play a game with $3$ piles of stones. They take turns and, on each turn, a player must choose a pile that still has stones and remove a positive number of stones from it. Whoever removes the last stone from the last pile that still had stones wins. Alice makes the first move.

The $i$-th pile will have a random and uniformly distributed number of stones in the range $[L_i , R_i ]$. What is the probability that Alice wins given that they both play optimally?

입력

The input consists of a line with $6$ integers, respectively, $L_1$, $R_1$, $L_2$, $R_2$, $L_3$, $R_3$. For each $i$, $1 ≤ L_i ≤ R_i ≤ 10^9$.

출력

Print an integer representing the probability that Alice wins modulo $10^9 + 7$.

It can be shown that the answer can be expressed as an irreducible fraction $\frac{p}{q}$, where $p$ and $q$ are integers and $q \not\equiv 0 \pmod{10^9 + 7}$, that is, we are interested in the integer $p × q^{-1} \pmod{10^9 + 7}$.

예제 입력 1

3 3 4 4 5 5

예제 출력 1

1

예제 입력 2

4 4 8 8 12 12

예제 출력 2

0

예제 입력 3

1 10 1 10 1 10

예제 출력 3

580000005

예제 입력 4

5 15 2 9 35 42

예제 출력 4

1