// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using ull = unsigned long long;

#define REP(i,n) for (ll i = 0; i < (n); ++i)



struct mint{

    static const long long MOD = 1000000007;



    long long v;



    mint() : v(0) {}

    mint(long long x){

        x = x % MOD;

        if(x < 0){ x += MOD; }

        v = x;

    }

    mint& operator+=(mint a){

        v += a.v;

        if(v >= MOD){ v -= MOD; }

        return *this;

    }

    mint& operator*=(mint a){

        v *= a.v;

        v %= MOD;

        return *this;

    }

    mint& operator-=(mint a){

        v -= a.v;

        if(v < 0){ v += MOD; }

        return *this;

    }

    mint& operator/=(mint a){

        return (*this) *= a.inv();

    }



    mint operator*(mint a) const{

        return mint(v) *= a;

    }



    mint operator+(mint a) const {

        return mint(v) += a;

    }



    mint operator-(mint a) const {

        return mint(v) -= a;

    }



    mint operator/(mint a) const {

        return mint(v) /= a;

    }



    mint pow(long long k) const {

        mint res(1),tmp(v);

        while(k){

            if(k&1) res *= tmp;

            tmp *= tmp;

            k >>= 1;

        }

        return res;

    }

    mint inv(){return pow(MOD - 2); }



    static mint comb(long long n, int k){

        mint res(1);

        for(int i = 0; i < k; ++i){

            res *= mint(n - i);

            res /= mint(i + 1);

        }

        return res;

    }



    static mint factorial(long long n){

        mint res(1);

        for(int i = n; i > 1; --i){

            res *= mint(i);

        }

        return res;

    }



    bool operator<(const mint &a) const {

        return v < a.v;

    };

};



mint operator*(long long l, mint r){ return r * l; }



std::ostream& operator<<(std::ostream& stream, const mint& m){

    stream << m.v;

    return stream;

}



struct mintcomb{

    vector<mint> fact;

    vector<mint> ifact;

    mintcomb(ll n) : fact(n + 1, 1), ifact(n + 1, 1) {

        for(ll i = 2; i <= n; ++i){

            fact.at(i) = fact.at(i - 1) * i;

            ifact.at(i) = fact.at(i).inv();

        }

    }



    mint factorial(ll k) const { return fact.at(k); }

    mint combination(ll k, ll l) const {

        return fact.at(k) * ifact.at(l) * ifact.at(k - l);

    }

};



vector<mint> pow2, pow2cs;



mint calc_triangle(ll n){

    mint ret = 0;

    REP(s, n + 1){

        ret += pow2.at(s);

    }

    return ret;

}



mint calc(ll r, ll c){

    mint ans = 0;

    ans += pow2cs.at(r + c);

    mintcomb mc(r + c + 1);

    REP(i, c){

        const mint v = mc.combination(r + i, i);

        ans -= v * pow2cs.at(c - i - 1);

    }

    REP(i, r){

        const mint v = mc.combination(c + i, i);

        ans -= v * pow2cs.at(r - i - 1);

    }

    return ans;

}



int main(){

    ll r1, c1, r2, c2;

    cin >> r1 >> c1 >> r2 >> c2;



    pow2.resize(r2 + c2 + 1);

    pow2.at(0) = 1;

    for(ll i = 1; i <= r2 + c2; ++i){

        pow2.at(i) = pow2.at(i - 1) * 2;

    }



    pow2cs.resize(pow2.size());

    REP(i, pow2cs.size()){

        pow2cs.at(i) = pow2.at(i);

        if(i > 0){

            pow2cs.at(i) += pow2cs.at(i - 1);

        }

    }





    const mint v1 = calc(r2, c2);

    const mint v2 = calc(r2, c1 - 1);

    const mint v3 = calc(r1 - 1, c2);

    const mint v4 = calc(r1 - 1, c1 - 1);

    const mint ans = v1 - v2 - v3 + v4;

    cout << ans << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using ull = unsigned long long;

#define REP(i,n) for (ll i = 0; i < (n); ++i)



struct mint{

    static const long long MOD = 1000000007;



    long long v;



    mint() : v(0) {}

    mint(long long x){

        x = x % MOD;

        if(x < 0){ x += MOD; }

        v = x;

    }

    mint& operator+=(mint a){

        v += a.v;

        if(v >= MOD){ v -= MOD; }

        return *this;

    }

    mint& operator*=(mint a){

        v *= a.v;

        v %= MOD;

        return *this;

    }

    mint& operator-=(mint a){

        v -= a.v;

        if(v < 0){ v += MOD; }

        return *this;

    }

    mint& operator/=(mint a){

        return (*this) *= a.inv();

    }



    mint operator*(mint a) const{

        return mint(v) *= a;

    }



    mint operator+(mint a) const {

        return mint(v) += a;

    }



    mint operator-(mint a) const {

        return mint(v) -= a;

    }



    mint operator/(mint a) const {

        return mint(v) /= a;

    }



    mint pow(long long k) const {

        mint res(1),tmp(v);

        while(k){

            if(k&1) res *= tmp;

            tmp *= tmp;

            k >>= 1;

        }

        return res;

    }

    mint inv(){return pow(MOD - 2); }



    static mint comb(long long n, int k){

        mint res(1);

        for(int i = 0; i < k; ++i){

            res *= mint(n - i);

            res /= mint(i + 1);

        }

        return res;

    }



    static mint factorial(long long n){

        mint res(1);

        for(int i = n; i > 1; --i){

            res *= mint(i);

        }

        return res;

    }



    bool operator<(const mint &a) const {

        return v < a.v;

    };

};



mint operator*(long long l, mint r){ return r * l; }



std::ostream& operator<<(std::ostream& stream, const mint& m){

    stream << m.v;

    return stream;

}



struct mintcomb{

    vector<mint> fact;

    vector<mint> ifact;

    mintcomb(ll n) : fact(n + 1, 1), ifact(n + 1, 1) {

        for(ll i = 2; i <= n; ++i){

            fact.at(i) = fact.at(i - 1) * i;

            ifact.at(i) = fact.at(i).inv();

        }

    }



    mint factorial(ll k) const { return fact.at(k); }

    mint combination(ll k, ll l) const {

        return fact.at(k) * ifact.at(l) * ifact.at(k - l);

    }

};



int main(){

    ll r1, c1, r2, c2;

    cin >> r1 >> c1 >> r2 >> c2;



    mintcomb mc(r2 + c2 + 2);



    const mint v1 = mc.combination(r2 + c2 + 2, c2 + 1) - 1;

    const mint v2 = mc.combination(r2 + c1 + 1, r2 + 1) - 1;

    const mint v3 = mc.combination(r1 + c2 + 1, c2 + 1) - 1;

    const mint v4 = mc.combination(r1 + c1, r1) - 1;

    const mint ans = v1 - v2 - v3 + v4;

    cout << ans << endl;

    return 0;

}


// Fastest known solution for this problem: