#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define LD double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 2000007;
const int MOD = 1e9 + 7;

int a1, a2, a3, a4, a5, a6;
int b1, b2, b3, b4, b5, b6;
int frac[MAXN], rf[MAXN];

void init ();
void input ();
void work ();



int add ( int x, int y )
{
	x += y;
	if ( x >= MOD ) x -= MOD;
	return x;
}

void addv ( int &x, int y )
{
	x += y;
	if ( x >= MOD ) x -= MOD;
}

int dec ( int x, int y )
{
	x -= y;
	if ( x < 0 ) x += MOD;
	return x;
}

void decv ( int &x, int y )
{
	x -= y;
	if ( x < 0 ) x += MOD;
}

int qpow ( int a, int b )
{
	LL base = a, ans = 1;
	while ( b ){
		if ( b & 1 ) ( ans *= base ) %= MOD;
		( base *= base ) %= MOD;
		b >>= 1;
	}
	return SC ( int, ans );
}



int C ( int n, int m )
{
	return SC ( int, SC ( LL, frac[n] ) * rf[m] % MOD * rf[n-m] % MOD );
}

int getmd ( int n, int m, int a, int b )
{
	return add ( dec ( dec ( C ( a+n+b+m, a+n ), C ( a+b+m, a ) ), C ( a+n+b, b ) ), C ( a+b, a ) );
}



int main ()
{
	init ();
	input ();
	work ();
}



void init ()
{
	// Init Everything Here

	ios::sync_with_stdio ( false );
	
	frac[0] = 1;
	lp ( i, 1, MAXN ) frac[i] = SC ( LL, frac[i-1] ) * i % MOD;
	rf[MAXN-1] = qpow ( frac[MAXN-1], MOD-2 );
	lpdi ( i, MAXN-2, 0 ) rf[i] = SC ( LL, rf[i+1] ) * ( i + 1 ) % MOD;
}

void input ()
{
	// input method
	
	cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
	cin >> b1 >> b2 >> b3 >> b4 >> b5 >> b6;
}

void work ()
{
	// main work
	
	int ans = 0;
	
	int n = a4 - a3 + 1, m = b4 - b3 + 1;
	int dx1 = a2 - a1 + 1, dx2 = a6 - a5 + 1, dy1 = b2 - b1 + 1, dy2 = b6 - b5 + 1;
	lp ( i, 0, n ){
		addv ( ans, SC ( LL, getmd ( dx1, dy1, ( i + a3 ) - a2, b3 - 1 - b2 ) ) * getmd ( dx2, dy2, a5 - ( i + a3 ), b5 - b3 ) % MOD * dec ( 0, i ) % MOD );
		addv ( ans, SC ( LL, getmd ( dx1, dy1, ( i + a3 ) - a2, b4 - b2 ) ) * getmd ( dx2, dy2, a5 - ( i + a3 ), b5 - ( b4 + 1 ) ) % MOD * ( i + m ) % MOD );
	}
	lp ( i, 0, m ){
		addv ( ans, SC ( LL, getmd ( dx1, dy1, a3 - 1 - a2, ( i + b3 ) - b2 ) ) * getmd ( dx2, dy2, a5 - a3, b5 - ( i + b3 ) ) % MOD * dec ( 0, i ) % MOD );
		addv ( ans, SC ( LL, getmd ( dx1, dy1, a4 - a2, ( i + b3 ) - b2 ) ) * getmd ( dx2, dy2, a5 - ( a4 + 1 ), b5 - ( i + b3 ) ) % MOD * ( i + n ) % MOD );
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 15872