#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    int solve(int r1, int r2, int c1, int c2) {
        const int MOD = 1e9 + 7;

        auto norm = [&](long long a) {
            a %= MOD;
            if (a < 0) {
                a += MOD;
            }
            return a;
        };

        auto inverse = [&](long long a) {
            long long b = MOD;
            long long u = 0, v = 1;
            a = norm(a);
            while (a != 0) {
                long long d = b / a;
                b -= d * a;
                u -= d * v;
                swap(a, b);
                swap(u, v);
            }
            u = norm(u);
            return u;
        };

        const int N = r2 + c2 + 100;
        vector<long long> F(N + 1, 1);
        vector<long long> IF(N + 1, 1);
        for (int i = 2; i <= N; ++i) {
            F[i] = F[i - 1] * i % MOD;
        }
        IF[N] = inverse(F[N]);
        for (int i = N - 1; i > 0; --i) {
            IF[i] = IF[i + 1] * (i + 1) % MOD;
            assert(IF[i] * F[i] % MOD == 1);
        }

        auto nCr = [&](int n, int r) -> long long {
            if (r < 0) {
                return 0;
            }
            if (r > n) {
                return 0;
            }
            long long res = F[n] * IF[r] % MOD * IF[n - r] % MOD;
            // cout << IF[n] << " " << F[n] << " " << IF[r] << endl;
            // cout << n << " to " << r << " " << res << endl;
            return res;
        };

        vector<long long> pow2(N + 1, 1);
        for (int i = 1; i <= N; ++i) {
            pow2[i] = (pow2[i - 1] * 2) % MOD;
        }

        auto count = [&](int R, int C) -> long long {
            long long res = 0;
            long long pre = 0;
            for (int i = 0; i <= R + C; ++i) {
                int l = max(0, i - C);
                int r = min(R, i);
                // cout << i << " : " << l << " " << r << " " << res <<  endl;
                if (l == 0 && r == i) {
                    res += pow2[i];
                    pre = pow2[i];
                    // cout << "cnt1 " << pre << endl;
                } else {
                    int s = i - 1;
                    int ll = max(0, s - C);
                    int rr = min(R, s);
                    long long cnt = pre * 2;
                    if (ll == l) {
                        cnt += nCr(s, l - 1);
                    } else {
                        // assert(ll == l - 1);
                        cnt -= nCr(s, ll);
                    }
                    if (rr == r) {
                        cnt -= nCr(s, r);
                    } else {
                        // assert(rr == r - 1);
                        cnt += nCr(s, r);
                    }
                    // cout << "cnt " << cnt << endl;
                    cnt = norm(cnt);
                    pre = cnt;
                    res += cnt;
                }
                
                res %= MOD;
            }
            // cout << R << " x " << C << " " << res << endl; 
            return res;
        };

        long long res = count(r2, c2) - count(r2, c1 - 1) - count(r1 - 1, c2) + count(r1 - 1, c1 - 1);
        res %= MOD;
        if (res < 0) {
            res += MOD;
        }
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int r1, r2;
    int c1, c2;
    cin >> r1 >> c1;
    cin >> r2 >> c2;

    Solution sol;
    cout << sol.solve(r1, r2, c1, c2) << "\n";

    return 0;
}

Measured memory_bytes: 47104