#include <bits/stdc++.h>
using namespace std;
const int MAXVAL = 3e6 + 1;
const int MOD = 1e9 + 7;
#define PII pair<int, int>
#define x first
#define y second

int main() {
    //ifstream cin("e.in");

    vector<int> x(6, 0), y(6, 0);
    for(int i = 0; i < 6; ++i)
        cin >> x[i];
    for(int i = 0; i < 6; ++i)
        cin >> y[i];
    
    vector<int> fact(MAXVAL, 1);
    vector<int> inv(MAXVAL, 1);
    vector<int> inv_fact(MAXVAL, 1);

    for(int i = 1; i <= MAXVAL; ++i)
        fact[i] = 1LL * i * fact[i - 1] % MOD;
    for(int i = 2; i <= MAXVAL; ++i)
        inv[i] = (MOD - 1LL * inv[MOD % i] * (MOD / i) % MOD);
    for(int i = 1; i <= MAXVAL; ++i)
        inv_fact[i] = 1LL * inv_fact[i - 1] * inv[i] % MOD;
    
    auto Comb = [&] (int n, int k) {
        int ans = 1LL * fact[n] * inv_fact[k] % MOD;
        ans = 1LL * ans * inv_fact[n - k] % MOD;
        return ans;
    };

    auto countPaths = [&] (int x, int y) {
        if(x < 0 or y < 0)
            return 0;
        return Comb(x + y, x);
    };
    
    auto countIntersecting  = [&] (PII start, PII end, PII lower_left, PII upper_right) {
        int ans = 0;

        for(int i = lower_left.y; i <= upper_right.y; ++i) {
            int paths = 1LL * countPaths(lower_left.x - start.x - 1, i - start.y) * countPaths(end.x - lower_left.x, end.y - i) % MOD;
            int coef = lower_left.x - start.x - 1 + i - start.y + 1;
            int sign = -1;
            ans += 1LL * sign * paths * coef % MOD;
            while(ans < 0)
                ans += MOD;
            ans %= MOD;
        }

        for(int i = lower_left.x; i <= upper_right.x; ++i) {
            int paths = 1LL * countPaths(i - start.x, lower_left.y - start.y - 1) * countPaths(end.x - i, end.y - lower_left.y) % MOD;
            int coef = i - start.x + lower_left.y - start.y -1 + 1;
            int sign = -1;
            ans += 1LL * sign * paths * coef % MOD;
            while(ans < 0)
                ans += MOD;
            ans %= MOD;
        }

        for(int i = lower_left.y; i <= upper_right.y; ++i) {
            int paths = 1LL * countPaths(upper_right.x - start.x, i - start.y) * countPaths(end.x - upper_right.x - 1, end.y - i) % MOD;
            int coef = upper_right.x - start.x + i - start.y + 1;
            int sign = 1;
            ans += 1LL * sign * paths * coef % MOD;
            while(ans < 0)
                ans += MOD;
            ans %= MOD;
        }

        for(int i = lower_left.x; i <= upper_right.x; ++i) {
            int paths = 1LL * countPaths(i - start.x, upper_right.y - start.y) * countPaths(end.x - i, end.y - upper_right.y - 1) % MOD;
            int coef = i - start.x + upper_right.y - start.y + 1;
            int sign = 1;
            ans += 1LL * sign * paths * coef % MOD;
            while(ans < 0)
                ans += MOD;
            ans %= MOD;
        }

        return ans;
    };
    
    //cout << countIntersecting({x[0], y[0]}, {x[4], y[4]}, {x[2], y[2]}, {x[2], y[2]}) << "\n";

    vector<PII> start, end;
    vector<int> sign_start, sign_end;


    start.push_back({x[0] - 1, y[0] - 1});
    sign_start.push_back(1);

    start.push_back({x[1], y[1]});
    sign_start.push_back(1);

    start.push_back({x[0] - 1, y[1]});
    sign_start.push_back(-1);

    start.push_back({x[1], y[0] - 1});
    sign_start.push_back(-1);

    
    end.push_back({x[5] + 1, y[5] + 1});
    sign_end.push_back(1);

    end.push_back({x[4], y[4]});
    sign_end.push_back(1);

    end.push_back({x[4], y[5] + 1});
    sign_end.push_back(-1);

    end.push_back({x[5] + 1, y[4]});
    sign_end.push_back(-1);
    
    int ans = 0;

    for(int i = 0; i < 4; ++i)
        for(int j = 0; j < 4; ++j) {
            int sgn = sign_start[i] * sign_end[j];
            ans += 1LL * sgn * countIntersecting(start[i], end[j], {x[2], y[2]}, {x[3], y[3]});
            while(ans < 0)
                ans += MOD;
            ans %= MOD;
        }

    cout << ans << "\n";
}

Measured memory_bytes: 35456