#f(r,c)=(r+c)_C_r

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

mod=10**9+7

N=2*(10**6)+10

def inv(x):

    return pow(x,mod-2,mod)

Fact=[0 for i in range(N+1)]

Fact[0]=1;

for i in range(N):

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

    Fact[i+1]%=mod

def C(n,k):

    res=Fact[n]*inv(Fact[n-k])

    res%=mod

    res*=inv(Fact[k])

    res%=mod

    return res

ans1=(((r2+2)*inv(c2+1))%mod)*C(c2+r2+2,r2+2)

ans2=(((r2+2)*inv(c1))%mod)*C(c1+r2+1,r2+2)

ans3=(((r1+1)*inv(c2+1))%mod)*C(c2+r1+1,r1+1)

ans4=(((r1+1)*inv(c1))%mod)*C(c1+r1,r1+1)

ans1%=mod

ans2%=mod

ans3%=mod

ans4%=mod

print(((ans1-ans2-ans3+ans4)%mod))

r1,c1,r2,c2=list(map(int,input().split()));mod=10**9+7;N=2000010

def inv(x):return pow(x,mod-2,mod)

Fact=[0 for i in range(N+1)];Fact[0]=1

for i in range(N):Fact[i+1]=((i+1)*Fact[i])%mod

def f(r,c):return (Fact[r+c]*inv(Fact[r])*inv(Fact[c]))%mod

print(((f(r2+1,c2+1)-f(r2+1,c1)-f(r1,c2+1)+f(r1,c1))%mod))
# f(r,c)=(r+c)_C_r
r1, c1, r2, c2 = list(map(int, input().split()))
mod = 10**9 + 7
N = 2 * (10**6) + 10


def inv(x):
    return pow(x, mod - 2, mod)


Fact = [0 for i in range(N + 1)]
Fact[0] = 1
for i in range(N):
    Fact[i + 1] = (i + 1) * Fact[i]
    Fact[i + 1] %= mod


def C(n, k):
    res = Fact[n] * inv(Fact[n - k])
    res %= mod
    res *= inv(Fact[k])
    res %= mod
    return res


ans1 = (((r2 + 2) * inv(c2 + 1)) % mod) * C(c2 + r2 + 2, r2 + 2)
ans2 = (((r2 + 2) * inv(c1)) % mod) * C(c1 + r2 + 1, r2 + 2)
ans3 = (((r1 + 1) * inv(c2 + 1)) % mod) * C(c2 + r1 + 1, r1 + 1)
ans4 = (((r1 + 1) * inv(c1)) % mod) * C(c1 + r1, r1 + 1)
ans1 %= mod
ans2 %= mod
ans3 %= mod
ans4 %= mod
print(((ans1 - ans2 - ans3 + ans4) % mod))

r1, c1, r2, c2 = list(map(int, input().split()))
mod = 10**9 + 7
N = 2000010


def inv(x):
    return pow(x, mod - 2, mod)


Fact = [0 for i in range(N + 1)]
Fact[0] = 1
for i in range(N):
    Fact[i + 1] = ((i + 1) * Fact[i]) % mod


def f(r, c):
    return (Fact[r + c] * inv(Fact[r]) * inv(Fact[c])) % mod


print(((f(r2 + 1, c2 + 1) - f(r2 + 1, c1) - f(r1, c2 + 1) + f(r1, c1)) % mod))

-# f(r,c)=(r+c)_C_r -N = 2 * (10**6) + 10 +N = 2000010 -    Fact[i + 1] = (i + 1) * Fact[i] -    Fact[i + 1] %= mod +    Fact[i + 1] = ((i + 1) * Fact[i]) % mod -def C(n, k): -    res = Fact[n] * inv(Fact[n - k]) -    res %= mod -    res *= inv(Fact[k]) -    res %= mod -    return res +def f(r, c): +    return (Fact[r + c] * inv(Fact[r]) * inv(Fact[c])) % mod -ans1 = (((r2 + 2) * inv(c2 + 1)) % mod) * C(c2 + r2 + 2, r2 + 2) -ans2 = (((r2 + 2) * inv(c1)) % mod) * C(c1 + r2 + 1, r2 + 2) -ans3 = (((r1 + 1) * inv(c2 + 1)) % mod) * C(c2 + r1 + 1, r1 + 1) -ans4 = (((r1 + 1) * inv(c1)) % mod) * C(c1 + r1, r1 + 1) -ans1 %= mod -ans2 %= mod -ans3 %= mod -ans4 %= mod -print(((ans1 - ans2 - ans3 + ans4) % mod)) +print(((f(r2 + 1, c2 + 1) - f(r2 + 1, c1) - f(r1, c2 + 1) + f(r1, c1)) % mod))