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>
using std::min;
using std::max;
using std::swap;
using std::vector;
typedef double db;
typedef long long ll;
#define pb(A) push_back(A)
#define pii std::pair<int,int>
#define all(A) A.begin(),A.end()
#define mp(A,B) std::make_pair(A,B)
#define inv(X) ksm(X,mod-2)
const int N=2e6+5;
const int mod=1e9+7;

int x[8],y[8];
int fac[N],ifac[N];

struct Node{
    int x,y,type;
    Node(){}
    Node(int a,int b,int c=0){x=a,y=b,type=c;}
}node[10];

int ksm(int x,int y,int ans=1){
    while(y){
        if(y&1) ans=1ll*ans*x%mod;
        x=1ll*x*x%mod;y>>=1;
    } return ans;
}

int getint(){
    int X=0,w=0;char ch=getchar();
    while(!isdigit(ch))w|=ch=='-',ch=getchar();
    while( isdigit(ch))X=X*10+ch-48,ch=getchar();
    if(w) return -X;return X;
}

int C(int n,int m){
    return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}

int G(int x1,int x2,int y1,int y2){
    return C(abs(x2-x1)+abs(y2-y1),abs(x2-x1));
}

int G(Node a,Node b){
    return C(abs(a.x-b.x)+abs(a.y-b.y),abs(a.x-b.x));
}

int cal(Node a,Node b){
    int ans=0;
    for(int i=x[3];i<=x[4];i++){
        ans=(1ll*ans-1ll*G(a,Node(i,y[3]-1))*G(Node(i,y[3]),b)%mod*(i+y[3])%mod+mod)%mod;
        ans=(1ll*ans+1ll*G(a,Node(i,y[4]))*G(Node(i,y[4]+1),b)%mod*(i+y[4]+1)%mod)%mod;
    }
    for(int i=y[3];i<=y[4];i++){
        ans=(1ll*ans-1ll*G(a,Node(x[3]-1,i))*G(Node(x[3],i),b)%mod*(i+x[3])%mod+mod)%mod;
        ans=(1ll*ans+1ll*G(a,Node(x[4],i))*G(Node(x[4]+1,i),b)%mod*(i+x[4]+1)%mod)%mod;
    } return (1ll*ans*a.type*b.type+mod)%mod;
}

signed main(){
    fac[0]=ifac[0]=1;
    for(int i=1;i<=N-5;i++) fac[i]=1ll*fac[i-1]*i%mod;
    ifac[N-5]=inv(fac[N-5]);
    for(int i=N-6;i;i--) ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
    for(int i=1;i<=6;i++) x[i]=getint();
    for(int i=1;i<=6;i++) y[i]=getint();
    node[1]=Node(x[1]-1,y[1]-1,1);node[2]=Node(x[2],y[1]-1,-1);
    node[3]=Node(x[1]-1,y[2],-1); node[4]=Node(x[2],y[2],1);
    node[5]=Node(x[5],y[5],1);    node[6]=Node(x[6]+1,y[5],-1);
    node[7]=Node(x[5],y[6]+1,-1); node[8]=Node(x[6]+1,y[6]+1,1);
    ll ans=0;
    for(int i=1;i<=4;i++)
        for(int j=5;j<=8;j++)
            ans=((ans+cal(node[i],node[j]))%mod+mod)%mod;
    printf("%lld\n",ans);
    return 0;
}