Triple

No attempts yetTime limit2sMemory limit1024 MB

Problem

Three ordered pairs in a row form an ordered triple, written (a,b),(c,d),(e,f)\langle (a,b), (c,d), (e,f) \rangle.

Rule 1. A triple is 00 when two of its three pairs are the same.

(a,b),(a,b),(a,b)=0(a,b),(a,b),(e,f)=0(a,b),(c,d),(a,b)=0(a,b),(c,d),(c,d)=0\begin{aligned} \langle (a,b), (a,b), (a,b) \rangle &= 0 \\ \langle (a,b), (a,b), (e,f) \rangle &= 0 \\ \langle (a,b), (c,d), (a,b) \rangle &= 0 \\ \langle (a,b), (c,d), (c,d) \rangle &= 0 \end{aligned}

A triple whose value is 00 is a zero triple.

Rule 2. Swapping two adjacent pairs flips the sign of a triple. A triple reached by an odd number of adjacent swaps is the original multiplied by 1-1, and a triple reached by an even number of adjacent swaps is equal to the original. Starting from (1,2),(3,4),(5,6)\langle (1,2), (3,4), (5,6) \rangle and swapping one adjacent pair at a time gives

(1,2),(3,4),(5,6)(3,4),(1,2),(5,6)(3,4),(5,6),(1,2)(5,6),(3,4),(1,2)(5,6),(1,2),(3,4)(1,2),(5,6),(3,4)\begin{aligned} \langle (1,2), (3,4), (5,6) \rangle &\to \langle (3,4), (1,2), (5,6) \rangle \\ &\to \langle (3,4), (5,6), (1,2) \rangle \\ &\to \langle (5,6), (3,4), (1,2) \rangle \\ &\to \langle (5,6), (1,2), (3,4) \rangle \\ &\to \langle (1,2), (5,6), (3,4) \rangle \end{aligned}

so the equalities below hold.

(1,2),(3,4),(5,6)=(3,4),(1,2),(5,6)=(3,4),(5,6),(1,2)=(5,6),(3,4),(1,2)=(5,6),(1,2),(3,4)=(1,2),(5,6),(3,4)\begin{aligned} \langle (1,2), (3,4), (5,6) \rangle &= -\langle (3,4), (1,2), (5,6) \rangle \\ &= \langle (3,4), (5,6), (1,2) \rangle \\ &= -\langle (5,6), (3,4), (1,2) \rangle \\ &= \langle (5,6), (1,2), (3,4) \rangle \\ &= -\langle (1,2), (5,6), (3,4) \rangle \end{aligned}

Add up every triple (a,b),(c,d),(e,f)\langle (a,b), (c,d), (e,f) \rangle whose six integers satisfy

a1aa2,b1bb2c1cc2,d1dd2e1ee2,f1ff2\begin{gathered} a_1 \le a \le a_2, \quad b_1 \le b \le b_2 \\ c_1 \le c \le c_2, \quad d_1 \le d \le d_2 \\ e_1 \le e \le e_2, \quad f_1 \le f \le f_2 \end{gathered}

Throw away the zero triples by Rule 1, cancel the pairs of triples that differ in sign by Rule 2, then count the distinct non-zero triples left in the sum. Triples that Rule 2 makes equal are one and the same triple, so a triple that survives twice with the same sign counts once.

Each of aa, bb, cc, dd, ee, ff is an integer between 00 and 100100, and the answer is between 00 and 10001000.

Input

One line holds 1212 integers separated by single spaces, in this order.

a1a2b1b2c1c2d1d2e1e2f1f2a_1 \quad a_2 \quad b_1 \quad b_2 \quad c_1 \quad c_2 \quad d_1 \quad d_2 \quad e_1 \quad e_2 \quad f_1 \quad f_2

The bounds satisfy 0a1a21000 \le a_1 \le a_2 \le 100, and the five other ranges follow the same rule.

Output

Print the number of distinct non-zero triples left in the sum, as one integer.