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

MOD=10**9+7

idx=r2+c2+3

perm=[1]*(idx+1)

for i in range(1,idx+1):

    perm[i]=perm[i-1]*i

    perm[i]%=MOD

def inv_mod(a):

  return pow(a,MOD-2,MOD)



def comb(n,m,p=10**9+7):

    if n < m : return 0

    if n < 0 or m < 0:return 0

    m = min(m, n-m)

    top = bot = 1

    for i in range(m):

        top = top*(n-i) % p

        bot = bot*(i+1) % p

    bot = pow(bot, p-2, p)

    return top*bot % p

def g(i,j):

    return comb(i+j+2,i+1,MOD)

def s(n,m):

    return comb(n+m+2, m+1, MOD)

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

res%=MOD



ans = s(r2,c2) - s(r2, c1-1) - s(r1-1, c2) + s(r1-1, c1-1)

ans %= MOD

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

MOD=10**9+7

idx=r2+c2+2

perm=[1]*(idx+1)

perm_inv=[1]*(idx+1)

for i in range(1,idx+1):

    perm[i]=perm[i-1]*i

    perm[i]%=MOD

def inv_mod(a):

  return pow(a,MOD-2,MOD)

perm_inv[-1]=inv_mod(perm[-1])

for i in range(idx-1,-1,-1):

    perm_inv[i]=perm_inv[i+1]*(i+1)

    perm_inv[i]%=MOD

def comb(i,j):

    buf=perm[i+j+2]

    buf*=perm_inv[i+1]

    buf%=MOD

    buf*=perm_inv[j+1]

    buf%=MOD

    return buf

res=comb(r2,c2)

res-=comb(r2,c1-1)

res-=comb(r1-1,c2)

res+=comb(r1-1,c1-1)

print((res%MOD))

r1, c1, r2, c2 = list(map(int, input().split()))
MOD = 10**9 + 7
idx = r2 + c2 + 3
perm = [1] * (idx + 1)
for i in range(1, idx + 1):
    perm[i] = perm[i - 1] * i
    perm[i] %= MOD


def inv_mod(a):
    return pow(a, MOD - 2, MOD)


def comb(n, m, p=10**9 + 7):
    if n < m:
        return 0
    if n < 0 or m < 0:
        return 0
    m = min(m, n - m)
    top = bot = 1
    for i in range(m):
        top = top * (n - i) % p
        bot = bot * (i + 1) % p
    bot = pow(bot, p - 2, p)
    return top * bot % p


def g(i, j):
    return comb(i + j + 2, i + 1, MOD)


def s(n, m):
    return comb(n + m + 2, m + 1, MOD)


res = g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1)
res %= MOD
ans = s(r2, c2) - s(r2, c1 - 1) - s(r1 - 1, c2) + s(r1 - 1, c1 - 1)
ans %= MOD
print(res)

r1, c1, r2, c2 = list(map(int, input().split()))
MOD = 10**9 + 7
idx = r2 + c2 + 2
perm = [1] * (idx + 1)
perm_inv = [1] * (idx + 1)
for i in range(1, idx + 1):
    perm[i] = perm[i - 1] * i
    perm[i] %= MOD


def inv_mod(a):
    return pow(a, MOD - 2, MOD)


perm_inv[-1] = inv_mod(perm[-1])
for i in range(idx - 1, -1, -1):
    perm_inv[i] = perm_inv[i + 1] * (i + 1)
    perm_inv[i] %= MOD


def comb(i, j):
    buf = perm[i + j + 2]
    buf *= perm_inv[i + 1]
    buf %= MOD
    buf *= perm_inv[j + 1]
    buf %= MOD
    return buf


res = comb(r2, c2)
res -= comb(r2, c1 - 1)
res -= comb(r1 - 1, c2)
res += comb(r1 - 1, c1 - 1)
print((res % MOD))

-idx = r2 + c2 + 3 +idx = r2 + c2 + 2 +perm_inv = [1] * (idx + 1) -def comb(n, m, p=10**9 + 7): -    if n < m: -        return 0 -    if n < 0 or m < 0: -        return 0 -    m = min(m, n - m) -    top = bot = 1 -    for i in range(m): -        top = top * (n - i) % p -        bot = bot * (i + 1) % p -    bot = pow(bot, p - 2, p) -    return top * bot % p +perm_inv[-1] = inv_mod(perm[-1]) +for i in range(idx - 1, -1, -1): +    perm_inv[i] = perm_inv[i + 1] * (i + 1) +    perm_inv[i] %= MOD -def g(i, j): -    return comb(i + j + 2, i + 1, MOD) +def comb(i, j): +    buf = perm[i + j + 2] +    buf *= perm_inv[i + 1] +    buf %= MOD +    buf *= perm_inv[j + 1] +    buf %= MOD +    return buf -def s(n, m): -    return comb(n + m + 2, m + 1, MOD) - - -res = g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1) -res %= MOD -ans = s(r2, c2) - s(r2, c1 - 1) - s(r1 - 1, c2) + s(r1 - 1, c1 - 1) -ans %= MOD -print(res) +res = comb(r2, c2) +res -= comb(r2, c1 - 1) +res -= comb(r1 - 1, c2) +res += comb(r1 - 1, c1 - 1) +print((res % MOD))