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≤109.
Print an integer representing the probability that Alice wins modulo 109+7.
It can be shown that the answer can be expressed as an irreducible fraction qp, where p and q are integers and q≡0(mod109+7), that is, we are interested in the integer p×q−1(mod109+7).