#include <bits/stdc++.h>
using namespace std;

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}

struct ModInt {
    long long value;
    static long long mod; // mod must be a prime number

    ModInt(long long v = 0) : value(v % mod) {}

    ModInt pow(long long n) const {
        long long x = value, res = 1;
        while(n > 0) {
            if(n & 1) {
                res = res * x % mod;
            }
            x = x * x % mod;
            n >>= 1;
        }
        return ModInt(res);
    }

    ModInt inverse() const {
        return pow(mod - 2);
    }

    ModInt operator-() const {
        return ModInt((mod - value) % mod);
    }

    ModInt& operator+=(const ModInt& a) {
        value += a.value;
        value %= mod;
        return *this;
    }

    ModInt& operator-=(const ModInt& a) {
        value += (-a).value;
        value %= mod;
        return *this;
    }

    ModInt& operator*=(const ModInt& a) {
        value *= a.value;
        value %= mod;
        return *this;
    }

    ModInt& operator/=(const ModInt& a) {
        return (*this) *= a.inverse();
    }

    ModInt operator+(const ModInt& a) const {
        return ModInt(*this) += a;
    }

    ModInt operator-(const ModInt& a) const {
        return ModInt(*this) -= a;
    }

    ModInt operator*(const ModInt& a) const {
        return ModInt(*this) *= a;
    }

    ModInt operator/(const ModInt& a) const {
        return ModInt(*this) /= a;
    }

    bool operator==(const ModInt& a) const {
        return value == a.value;
    }

    bool operator!=(const ModInt& a) const {
        return value != a.value;
    }

    friend std::istream& operator>>(std::istream& is, ModInt& a) {
        long long v;
        is >> v;
        a = v;
        return is;
    }

    friend std::ostream& operator<<(std::ostream& os, const ModInt& a) {
        os << a.value;
        return os;
    }    
};

long long ModInt::mod = MOD;
using mint = ModInt;

class Combination {
public:
    int N;
    vector<mint> fact;
    vector<mint> factsum;

    Combination(int n) : N(n), fact(n+1), factsum(n+1) {
        fact[0] = 1;
        factsum[0] = 1;
        for(ll i=1; i<=N; i++){
            fact[i] = fact[i-1] * i;
            factsum[i] = factsum[i-1] + fact[i];
        }
    }    

    // a ** b (mod m)
    static mint modpow(mint a, ll n) {
        mint res = 1;
        while(n > 0) {
            if(n & 1) {
                res *= a;
            }
            a *= a;
            n >>= 1;
        }
        return res;
    }

    // a / b (mod m)
    static mint moddiv(const mint& a, const mint& b) {
        return a * modpow(b, mint::mod - 2);
    }

    mint combin(int n, int k) {
        if(n < 0 || k < 0 || n < k) {
            return 1;
        }
        return fact[n] * modpow(fact[k] * fact[n-k], mint::mod - 2);
    }
};

signed main(){
    ll r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    ll n = r2 + c2 + 100;

    Combination C(n);

    vector<mint> dp1(r2+10), dp2(r2+10);
    REP(i, dp1.size()){
        dp1[i] = C.fact[i + c1 - 1] / (C.fact[i] * C.fact[c1 - 1]);
        dp2[i] = C.fact[i + c2] / (C.fact[i] * C.fact[c2]);
    }

    mint ans = 0;
    REP(i, r2+1){
        ans += dp2[i+1];
        ans -= dp1[i+1];
    }
    REP(i, r1){
        ans -= dp2[i+1];
        ans += dp1[i+1];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 47104