Three ordered pairs in a row form an ordered triple, written ⟨(a,b),(c,d),(e,f)⟩.
Rule 1. A triple is 0 when two of its three pairs are the same.
⟨(a,b),(a,b),(a,b)⟩⟨(a,b),(a,b),(e,f)⟩⟨(a,b),(c,d),(a,b)⟩⟨(a,b),(c,d),(c,d)⟩=0=0=0=0A triple whose value is 0 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, and a triple reached by an even number of adjacent swaps is equal to the original. Starting from ⟨(1,2),(3,4),(5,6)⟩ 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)⟩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)⟩Add up every triple ⟨(a,b),(c,d),(e,f)⟩ whose six integers satisfy
a1≤a≤a2,b1≤b≤b2c1≤c≤c2,d1≤d≤d2e1≤e≤e2,f1≤f≤f2Throw 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 a, b, c, d, e, f is an integer between 0 and 100, and the answer is between 0 and 1000.
One line holds 12 integers separated by single spaces, in this order.
a1a2b1b2c1c2d1d2e1e2f1f2The bounds satisfy 0≤a1≤a2≤100, and the five other ranges follow the same rule.
Print the number of distinct non-zero triples left in the sum, as one integer.