Problem: Joisino is planning on touring Takahashi Town. The town is divided into square sections by north-south and east-west lines. We will refer to the section that is the x-th from the west and the y-th from the north as (x,y).

Joisino thinks that a touring plan is good if it satisfies the following conditions:

* Let (p,q) be the section where she starts the tour. Then, X_1 \leq p \leq X_2 and Y_1 \leq q \leq Y_2 hold.

* Let (s,t) be the section where she has lunch. Then, X_3 \leq s \leq X_4 and Y_3 \leq t \leq Y_4 hold.

* Let (u,v) be the section where she ends the tour. Then, X_5 \leq u \leq X_6 and Y_5 \leq v \leq Y_6 hold.

* By repeatedly moving to the adjacent section (sharing a side), she travels from the starting section to the ending section in the shortest distance, passing the lunch section on the way.




Two touring plans are considered different if at least one of the following is different: the starting section, the lunch section, the ending section, and the sections that are visited on the way. Joisino would like to know how many different good touring plans there are. Find the number of the different good touring plans. Since it may be extremely large, find the count modulo 10^9+7.

Constraints

* 1 \leq X_1 \leq X_2 < X_3 \leq X_4 < X_5 \leq X_6 \leq 10^6
* 1 \leq Y_1 \leq Y_2 < Y_3 \leq Y_4 < Y_5 \leq Y_6 \leq 10^6

Input

Input is given from Standard Input in the following format:


X_1 X_2 X_3 X_4 X_5 X_6
Y_1 Y_2 Y_3 Y_4 Y_5 Y_6


Output

Print the number of the different good touring plans, modulo 10^9+7.

Examples

Input

1 1 2 2 3 4
1 1 2 2 3 3


Output

10


Input

1 2 3 4 5 6
1 2 3 4 5 6


Output

2346


Input

77523 89555 420588 604360 845669 973451
2743 188053 544330 647651 709337 988194


Output

137477680

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=1e9+7;
int A,B,C,D,X1,X2,X3,X4,X5,X6,Y1,Y2,Y3,Y4,Y5,Y6;
LL fac[3000010],inv[3000010],ans;
LL pw(LL x,LL y){
	LL t=1;
	for (;y;y>>=1){
		if (y&1) t=t*x%MO;
		x=x*x%MO;
	}
	return t;
}
LL Co(int x,int y){
	assert(y<=x && 0<=y);
	return fac[x]*inv[y]%MO*inv[x-y]%MO;
}
LL cal1(int x,int y){
	assert(x>=A && y>=B);
	return Co(x+y-A-B,x-A);
}
LL cal2(int x,int y){
	assert(x<=C && y<=D);
	return Co(C+D-x-y,C-x);
}
LL cal(int x,int y){
	return cal1(x,y)*cal2(x,y)%MO;
}
LL doit(){
	LL ans=0;
	if (X4-X3<=Y4-Y3){
		LL t=cal(X3,Y3);
		ans=t;
		FOR(i,X3+1,X4)
			(t+=cal1(i,Y3-1)*cal2(i,Y3)+cal1(X3-1,Y3+i-X3)*cal2(X3,Y3+i-X3))%=MO,(ans+=t)%=MO;
		FOR(i,Y3+1,Y4-X4+X3)
			(t+=cal1(X3-1,i+X4-X3)*cal2(X3,i+X4-X3)-cal1(X4,i-1)*cal2(X4+1,i-1))%=MO,(ans+=t)%=MO;
		FOR(i,X3+1,X4)
			(t-=cal1(i-1,Y4)*cal2(i-1,Y4+1)+cal1(X4,Y4-X4+i-1)*cal2(X4+1,Y4-X4+i-1))%=MO,(ans+=t)%=MO;
		return ans;
	}
	else{
		LL t=cal(X3,Y3);
		ans=t;
		FOR(i,Y3+1,Y4)
			(t+=cal1(X3-1,i)*cal2(X3,i)+cal1(i-Y3+X3,Y3-1)*cal2(i-Y3+X3,Y3))%=MO,(ans+=t)%=MO;
		FOR(i,X3+1,X4-Y4+Y3)
			(t+=cal1(i+Y4-Y3,Y3-1)*cal2(i+Y4-Y3,Y3)-cal1(i-1,Y4)*cal2(i-1,Y4+1))%=MO,(ans+=t)%=MO;
		FOR(i,Y3+1,Y4)
			(t-=cal1(X4-Y4+i-1,Y4)*cal2(X4-Y4+i-1,Y4+1)+cal1(X4,i-1)*cal2(X4+1,i-1))%=MO,(ans+=t)%=MO;
		return ans;
	}
}
int main(){
	fac[0]=1;
	FOR(i,1,3000000) fac[i]=fac[i-1]*i%MO;
	inv[3000000]=pw(fac[3000000],MO-2);
	FORD(i,2999999,0) inv[i]=inv[i+1]*(i+1)%MO;
	cin>>X1>>X2>>X3>>X4>>X5>>X6;
	cin>>Y1>>Y2>>Y3>>Y4>>Y5>>Y6;
	FOR(i,0,1)
		FOR(j,0,1)
			FOR(k,0,1)
				FOR(l,0,1){
					A=(i==0)?(X1-1):(X2);
					B=(j==0)?(Y1-1):(Y2);
					C=(k==0)?(X6+1):(X5);
					D=(l==0)?(Y6+1):(Y5);
					(ans+=doit()*pw(-1,i+j+k+l))%=MO;
				}
	ans=(ans%MO+MO)%MO;
	cout<<ans<<endl;
	return 0;
}