Fun with Stones

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Alice and Bob will play a game with 33 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 ii-th pile will have a random and uniformly distributed number of stones in the range \[L_i,R_i]\[L\_i , R\_i ]. What is the probability that Alice wins given that they both play optimally?

입력

The input consists of a line with 66 integers, respectively, L_1L\_1, R_1R\_1, L_2L\_2, R_2R\_2, L_3L\_3, R_3R\_3. For each ii, 1L_iR_i1091 ≤ L\_i ≤ R\_i ≤ 10^9.

출력

Print an integer representing the probability that Alice wins modulo 109+710^9 + 7.

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