#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; namespace my_io{ template istream& operator >> (istream& is, vector& vec){for(T& val: vec) is >> val; return is;} template istream& operator , (istream& is, T& val){ return is >> val;} template ostream& operator << (ostream& os, const vector& vec){for(int i=0; i ostream& operator , (ostream& os, const T& val){ return os << " " << val;} template ostream& operator >> (ostream& os, const T& val){ return os << " " << val;} template void println(const H& head){ cout << head << endl; } template void println(const H& head, const T& ... tail){ cout << head << " "; println(tail...); } } using namespace my_io; const long long MOD = 1000000007; int main(){ vector> v(7, vector(2)); cin >> v; int low = 1; int high = 20000; vector A = {0,2,4,6}; vector B = {1,3,5}; long long ans = 0; {//A < B vector> dp_A(1<<4, vector(20005,0)); vector> dp_A_ok(1<<4, vector(20005,0)); vector> dp_B(1<<3, vector(20005,0)); vector> dp_B_ok(1<<3, vector(20005,0)); for(int a=low; a<=high; a++){ for(int k=0; k<(1<<4)-1; k++){ dp_A[k][a] += dp_A[k][a-1]; dp_A[k][a] %= MOD; for(int x=0; x<4; x++){ if((k>>x)&1) continue; if(a < v[A[x]][0] || v[A[x]][1] < a) continue; dp_A[k|(1<=low; a--){ for(int k=0; k<(1<<3); k++){ dp_B[k][a] += dp_B[k][a+1]; dp_B[k][a] %= MOD; for(int x=0; x<3; x++){ if((k>>x)&1) continue; if(a < v[B[x]][0] || v[B[x]][1] < a) continue; dp_B[k|(1< B vector> dp_A(1<<4, vector(20005,0)); vector> dp_A_ok(1<<4, vector(20005,0)); vector> dp_B(1<<3, vector(20005,0)); vector> dp_B_ok(1<<3, vector(20005,0)); for(int a=high; a>=low; a--){ for(int k=0; k<(1<<4); k++){ dp_A[k][a] += dp_A[k][a+1]; dp_A[k][a] %= MOD; for(int x=0; x<4; x++){ if((k>>x)&1) continue; if(a < v[A[x]][0] || v[A[x]][1] < a) continue; dp_A[k|(1<>x)&1) continue; if(a < v[B[x]][0] || v[B[x]][1] < a) continue; dp_B[k|(1<