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 <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <vector>
#include <stack>
#include <cassert>
#define mp make_pair
#define MIN(a,b) (a>b?b:a)
//#define MAX(a,b) (a>b?a:b)
typedef long long ll;
typedef unsigned long long ull;
const int MAX=2e6+5;
const int INF=1e9+5;
using namespace std;
const ll MOD=1000000007;
typedef pair<ll,int> pii;
typedef pair<ll,ll> pll;
const double eps=0.00000001;
ll fact[MAX],inv[MAX];
ll x[10],y[10];
ll pow_mod(ll a,ll b) {ll res=1;a%=MOD; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
ll num(ll sx,ll sy,ll ex,ll ey)//从（sx,sy）到（ex，ey）情况数
{
    ex-=sx;ey-=sy;
    return fact[(ex+ey)]*inv[ex]%MOD*inv[ey]%MOD;
}
ll cal(ll sx,ll sy,ll ex,ll ey)//从（sx,sy）到（ex,ey）过程中经过B区域的情况数
{
    ll re=0,now=num(sx,sy,x[3],y[3])*num(x[3],y[3],ex,ey)%MOD;
    re=now;
    ll right_x,right_y,down_x,down_y;//向右、向下走的坐标
    right_x=down_x=x[3];right_y=down_y=y[3];
    for(ll step=x[3]+y[3]+1;step<x[4]+y[4];step++)
    {
        if(right_x!=x[4])
        {
            now+=num(sx,sy,right_x+1,right_y-1)*num(right_x+1,right_y,ex,ey)%MOD;
            ++right_x;
        }
        else
        {
            now-=num(sx,sy,right_x,right_y)*num(right_x+1,right_y,ex,ey)%MOD;
            ++right_y;
        }
        if(down_y!=y[4])
        {
            now+=num(sx,sy,down_x-1,down_y+1)*num(down_x,down_y+1,ex,ey)%MOD;
            ++down_y;
        }
        else
        {
            now-=num(sx,sy,down_x,down_y)*num(down_x,down_y+1,ex,ey)%MOD;
            ++down_x;
        }
        now%=MOD;
        re=(re+now)%MOD;
    }
    if(x[3]!=x[4]||y[3]!=y[4])
        re=(re+num(sx,sy,x[4],y[4])*num(x[4],y[4],ex,ey)%MOD)%MOD;
    return re;
}
int main()
{
    fact[0]=fact[1]=1;
    for(ll i=1;i<=2e6+1;i++)
        fact[i]=fact[i-1]*i%MOD;
    inv[(int)2e6+1]=pow_mod(fact[(int)2e6+1],MOD-2);
    for(ll i=2e6;i>=1;i--)
        inv[i]=(i+1)*inv[i+1]%MOD;
    for(ll i=1;i<=6;i++)
        scanf("%lld",&x[i]);
    for(ll i=1;i<=6;i++)
        scanf("%lld",&y[i]);
    --x[1];--y[1];
    ++x[6];++y[6];
    ll an=0;
    for(int i=1;i<=2;i++)
        for(int j=1;j<=2;j++)
            for(int p=5;p<=6;p++)
                for(int q=5;q<=6;q++)
                    an=(an+((i+j-p-q)%2?-1:1)*cal(x[i],y[j],x[p],y[q]))%MOD;
	an%=MOD;
    while(an<0)
        an+=MOD;
    printf("%lld\n",an);
}