import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long r1, c1, r2, c2;
    scan(r1, c1, r2, c2);

    auto fact = new long[](r2 + c2 + 2);
    fact[0] = 1;
    foreach (i; 1 .. fact.length)
        fact[i] = fact[i - 1] * i % MOD;
    auto fact_inv = new long[](fact.length);
    foreach (i; 0 .. fact_inv.length)
        fact_inv[i] = powmod(fact[i], MOD - 2, MOD);

    long combination_mod(long n, long k)
    {
        if (n < k)
            return 1;
        return (fact[n] * fact_inv[k] % MOD) * fact_inv[n - k] % MOD;
    }

    long g(long r, long c)
    {
        long ans;
        foreach (y; 0 .. r + 1)
        {
            ans = (ans + combination_mod(y + c + 1, y + 1)) % MOD;
        }
        return ans;
    }

    writeln((MOD * 2 + g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1)) % MOD);
}

T powmod(T = long)(T x, T n, T m)
{
    if (n < 1)
        return 1;
    if (n & 1)
    {
        return x * powmod(x, n - 1, m) % m;
    }
    T tmp = powmod(x, n / 2, m);
    return tmp * tmp % m;
}
