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<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int mod=1e9+7;
const int N=2000010,maxn=2000000;

int l[4],r[4],u[4],d[4];
int cj[N],inv[N];

int ans,sum;

int power(int x,int y){
	int ret=1;
	for(;y;y>>=1,x=1ll*x*x%mod){
		if(y&1)	ret=1ll*ret*x%mod;
	}
	return ret;
}

void init(){
	int i;
	cj[0]=1;rep(i,1,maxn)	cj[i]=1ll*cj[i-1]*i%mod;
	inv[maxn]=power(cj[maxn],mod-2);inv[0]=1;
	for(i=maxn-1;i;i--)	inv[i]=1ll*inv[i+1]*(i+1)%mod;
}

int C(int i,int j){
	return 1ll*cj[i]*inv[j]%mod*inv[i-j]%mod;
}

int work1(int x,int y){
	int tmp1=0;int i,j;
	tmp1=(C(x-r[1]+y-d[1],y-d[1])+C(x-l[1]+1+y-u[1]+1,x-l[1]+1)-C(x-l[1]+1+y-d[1],y-d[1])-C(x-r[1]+y-u[1]+1,x-r[1]))%mod;
	tmp1=(tmp1+mod)%mod;
//	rep(i,l[1],r[1]){
//		rep(j,u[1],d[1]){
//			tmp1=(tmp1+C(x-i+y-j,y-j))%mod;
//		}
//	}
	return tmp1;
}
int work2(int x,int y){
	int i,j,tmp2=0;
	tmp2=(C(l[3]-x+u[3]-y,l[3]-x)+C(r[3]+1-x+d[3]+1-y,r[3]+1-x)-C(l[3]-x+d[3]+1-y,l[3]-x)-C(r[3]+1-x+u[3]-y,u[3]-y))%mod;
	tmp2=(tmp2+mod)%mod;
//	rep(i,l[3],r[3]){
//		rep(j,u[3],d[3]){
//			tmp2=(tmp2+C(i-x+j-y,j-y))%mod;
//		}
//	}
	return tmp2;
}

/*void work(int x,int y){
	return 1ll*work1(x,y)*work2(x,y)%mod;
}*/

int main(){
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	int i,j;int tmp1,tmp2,tmp3;
	init();
	scanf("%d%d%d%d%d%d",&l[1],&r[1],&l[2],&r[2],&l[3],&r[3]);
	scanf("%d%d%d%d%d%d",&u[1],&d[1],&u[2],&d[2],&u[3],&d[3]);
	
//	rep(i,l[2],r[2])
//		rep(j,u[2],d[2])
//			work(i,j);
	rep(i,l[2],r[2]){
		tmp1=work2(i,d[2]+1);
		tmp2=work1(i,d[2]);
		tmp3=1ll*tmp1*tmp2%mod;
		sum=(sum+tmp3)%mod;
		ans=(ans-1ll*tmp3*(r[2]-i)%mod+mod)%mod;
		tmp1=work2(i,u[2]);
		tmp2=work1(i,u[2]-1);
		tmp3=1ll*tmp1*tmp2%mod;
		ans=(ans-1ll*tmp3*(i-l[2])%mod+mod)%mod;
	}
	rep(j,u[2],d[2]){
		tmp1=work2(r[2]+1,j);
		tmp2=work1(r[2],j);
		tmp3=1ll*tmp1*tmp2%mod;
		sum=(sum+tmp3)%mod;
		ans=(ans-1ll*tmp3*(d[2]-j)%mod+mod)%mod;
		tmp1=work2(l[2],j);
		tmp2=work1(l[2]-1,j);
		tmp3=1ll*tmp1*tmp2%mod;
		ans=(ans-1ll*tmp3*(j-u[2])%mod+mod)%mod;
	}
	ans=(ans+1ll*(r[2]-l[2]+d[2]-u[2]+1)*sum)%mod;
			
	printf("%d\n",ans);
}