#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
#define MAX 3000010
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(ll n, ll k) {
    if(n < k)
        return 0;
    if(n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
    ll r1, r2, c1, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    COMinit();
    r2++, c2++;
    ll t1 = COM(r2 + c2, c2) - 1;
    ll t2 = COM(r2 + c1, c1) - 1;
    ll t3 = COM(r1 + c2, c2) - 1;
    ll t4 = COM(r1 + c1, r1) - 1;
    cout << ((t1 - t2 - t3 + t4) % MOD + MOD) % MOD << endl;
}