#include <iostream>
#include <algorithm>

#define MOD 1000000007

using namespace std;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

long g(int r, int c){
    long ans = 0;
    long a = c+1;
    for(long i=0; i<r+1; i++){
        ans += a;
        ans %= MOD;
        a *= (c + i + 2);
        a %= MOD;
        a *= modinv(i+2, MOD);
        a %= MOD;
    }
    return ans;
}


int main(){
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    long ans = 0;
    cout << (g(r2, c2) - g(r1-1, c2) - g(r2, c1-1) + g(r1-1, c1-1) + MOD) % MOD << endl;
    return 0;
}