r1, c1, r2, c2 = list(map(int, input().split()))

mod = 10 ** 9 + 7



fac = [1]

inv = [1]

for i in range(1, r2 + c2 + 10) :

  fac.append(fac[-1] * i % mod)

  inv.append(pow(fac[-1], mod - 2, mod))



def comb(n, r) :

  return fac[n] * inv[n-r] % mod * inv[r] % mod



def g(x, y) :

  return comb(x + y, y)



ret = g(r2+1, c2+1) - g(r2+1, c1) - g(r1, c2+1) + g(r1, c1)

ret %= mod



print(ret)
r1, c1, r2, c2 = list(map(int, input().split()))

mod = 10 ** 9 + 7



n = r2 + c2 + 10



fac = [0] * n

inv = [0] * n

finv = [0] * n

fac[0] = fac[1] = 1

finv[0] = finv[1] = 1

inv[1] = 1



for i in range(2, n) :

  fac[i] = fac[i-1] * i % mod

  inv[i] = mod - inv[mod%i] * (mod // i) % mod

  finv[i] = finv[i-1] * inv[i] % mod



def comb(n, r) :

  return fac[n] * finv[n-r] % mod * finv[r] % mod



def g(x, y) :

  return comb(x + y, y)



ret = g(r2+1, c2+1) - g(r2+1, c1) - g(r1, c2+1) + g(r1, c1)

ret %= mod



print(ret)
r1, c1, r2, c2 = list(map(int, input().split()))
mod = 10**9 + 7
fac = [1]
inv = [1]
for i in range(1, r2 + c2 + 10):
    fac.append(fac[-1] * i % mod)
    inv.append(pow(fac[-1], mod - 2, mod))


def comb(n, r):
    return fac[n] * inv[n - r] % mod * inv[r] % mod


def g(x, y):
    return comb(x + y, y)


ret = g(r2 + 1, c2 + 1) - g(r2 + 1, c1) - g(r1, c2 + 1) + g(r1, c1)
ret %= mod
print(ret)

r1, c1, r2, c2 = list(map(int, input().split()))
mod = 10**9 + 7
n = r2 + c2 + 10
fac = [0] * n
inv = [0] * n
finv = [0] * n
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, n):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def comb(n, r):
    return fac[n] * finv[n - r] % mod * finv[r] % mod


def g(x, y):
    return comb(x + y, y)


ret = g(r2 + 1, c2 + 1) - g(r2 + 1, c1) - g(r1, c2 + 1) + g(r1, c1)
ret %= mod
print(ret)

-fac = [1] -inv = [1] -for i in range(1, r2 + c2 + 10): -    fac.append(fac[-1] * i % mod) -    inv.append(pow(fac[-1], mod - 2, mod)) +n = r2 + c2 + 10 +fac = [0] * n +inv = [0] * n +finv = [0] * n +fac[0] = fac[1] = 1 +finv[0] = finv[1] = 1 +inv[1] = 1 +for i in range(2, n): +    fac[i] = fac[i - 1] * i % mod +    inv[i] = mod - inv[mod % i] * (mod // i) % mod +    finv[i] = finv[i - 1] * inv[i] % mod -    return fac[n] * inv[n - r] % mod * inv[r] % mod +    return fac[n] * finv[n - r] % mod * finv[r] % mod