#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() {
    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;
    };
    
    vector<int> v = {x[0] - 1, y[0] - 1};
    vector<int> w = {x[1], y[1]};
    
    vector<PII> points[2];
    vector<int> signs[2];

    for(int t = 0; t < 2; ++t) {
        for(int mask = 0; mask < 4; ++mask) {
            vector<int> p = w;
            int sgn = 1;
            for(int i = 0; i < 2; ++i)
                if((1 << i) & mask) {
                    p[i] = v[i];
                    sgn *= -1;
                } 
            points[t].push_back({p[0], p[1]});
            signs[t].push_back(sgn);
        }
        v = {x[5] + 1, y[5] + 1};
        w = {x[4], y[4]};
    }

    int ans = 0;

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

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

Measured memory_bytes: 35456