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 <stdio.h>

typedef long long var;

const int N = 2100006;
const int MOD = 1e9 + 7;

struct Node {
  int x, y;
};

struct Rect {
  Node ld, ru;
};

var inv[N + 1], fac[N + 1], invfac[N + 1];
Rect begin, mid, end;

var c(int n, int m);
var f(int n, int m);
var operator & (Node a, Node b);
var operator & (Node t, Rect c);

int main() {
  inv[0] = fac[0] = invfac[0] = inv[1] = 1;
  for (int i = 2; i <= N; ++i) 
    inv[i] = ((MOD - MOD / i) * inv[MOD % i]) % MOD;
  for (int i = 1; i <= N; ++i) {
    fac[i] = (fac[i - 1] * i) % MOD;
    invfac[i] = (invfac[i - 1] * inv[i]) % MOD;
  }
  scanf("%d%d%d%d%d%d", &begin.ld.x, &begin.ru.x, &mid.ld.x, &mid.ru.x, &end.ld.x, &end.ru.x);
  scanf("%d%d%d%d%d%d", &begin.ld.y, &begin.ru.y, &mid.ld.y, &mid.ru.y, &end.ld.y, &end.ru.y);
  var res = 0;
  for (int i = mid.ld.x; i <= mid.ru.x; ++i) {
    var way = (((Node) {i, mid.ld.y - 1} & begin) * ((Node) {i, mid.ld.y} & end)) % MOD;
    (res -= (way * (i + mid.ld.y)) % MOD) %= MOD;
  }
  for (int i = mid.ld.y; i <= mid.ru.y; ++i) {
    var way = (((Node) {mid.ld.x - 1, i} & begin) * ((Node) {mid.ld.x, i} & end)) % MOD;
    (res -= (way * (mid.ld.x + i)) % MOD) %= MOD;
  }
  for (int i = mid.ld.x; i <= mid.ru.x; ++i) {
    var way = (((Node) {i, mid.ru.y} & begin) * ((Node) {i, mid.ru.y + 1} & end)) % MOD;
    (res += (way * (i + mid.ru.y + 1)) % MOD) %= MOD;
  }
  for (int i = mid.ld.y; i <= mid.ru.y; ++i) {
    var way = (((Node) {mid.ru.x, i} & begin) * ((Node) {mid.ru.x + 1, i} & end)) % MOD;
    (res += (way * (mid.ru.x + i + 1)) % MOD) %= MOD;
  }
  printf("%lld\n", (res + MOD) % MOD);
  return 0;
}

var c(int n, int m) { return (((fac[n] * invfac[m]) % MOD) * invfac[n - m]) % MOD; }

var f(int n, int m) { return c(n + m, n); }

var operator & (Node t, Rect r) {
  if (t.x >= r.ru.x) t.x = r.ld.x - (t.x - r.ru.x);
  if (t.y >= r.ru.y) t.y = r.ld.y - (t.y - r.ru.y);
  r.ld.x -= t.x, r.ru.x -= t.x, r.ld.y -= t.y, r.ru.y -= t.y;
  return (((f(r.ru.x + 1, r.ru.y + 1) + f(r.ld.x, r.ld.y)) % MOD) 
      - ((f(r.ru.x + 1, r.ld.y) + f(r.ld.x, r.ru.y + 1)) % MOD)) % MOD;
}