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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = 1e9;
const LL LLINF = 1e18;
#define pow10(n) int(1e##n + n)

template <int MOD>
struct mint
{ // modified from http://drken1215.hatenablog.com/entry/2020/02/09/225000
    long long val;
    constexpr mint(long long v = 0) noexcept : val(v % MOD)
    {
        if (val < 0)
            val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr mint operator-() const noexcept
    {
        return val ? MOD - val : 0;
    }
    constexpr mint operator+(const mint &r) const noexcept { return mint(*this) += r; }
    constexpr mint operator-(const mint &r) const noexcept { return mint(*this) -= r; }
    constexpr mint operator*(const mint &r) const noexcept { return mint(*this) *= r; }
    constexpr mint operator/(const mint &r) const noexcept { return mint(*this) /= r; }
    constexpr mint &operator+=(const mint &r) noexcept
    {
        val += r.val;
        if (val >= MOD)
            val -= MOD;
        return *this;
    }
    constexpr mint &operator-=(const mint &r) noexcept
    {
        val -= r.val;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr mint &operator*=(const mint &r) noexcept
    {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr mint &operator/=(const mint &r) noexcept
    {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b)
        {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr bool operator==(const mint &r) const noexcept
    {
        return this->val == r.val;
    }
    constexpr bool operator!=(const mint &r) const noexcept
    {
        return this->val != r.val;
    }
    friend constexpr ostream &operator<<(ostream &os, const mint<MOD> &x) noexcept
    {
        return os << x.val;
    }
    friend constexpr mint<MOD> modpow(const mint<MOD> &a, long long n) noexcept
    {
        if (n == 0)
            return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1)
            t = t * a;
        return t;
    }
};

template <class T>
struct BiCoef
{
    // http://drken1215.hatenablog.com/entry/2020/02/09/225000
    vector<T> fact_, inv_, finv_;
    constexpr BiCoef() {}
    constexpr BiCoef(int n) noexcept : fact_(n, 1), inv_(n, 1), finv_(n, 1)
    {
        init(n);
    }
    constexpr void init(int n) noexcept
    {
        fact_.assign(n, 1), inv_.assign(n, 1), finv_.assign(n, 1);
        int MOD = fact_[0].getmod();
        for (int i = 2; i < n; i++)
        {
            fact_[i] = fact_[i - 1] * i;
            inv_[i] = -inv_[MOD % i] * (MOD / i);
            finv_[i] = finv_[i - 1] * inv_[i];
        }
    }
    constexpr T com(int n, int k) const noexcept
    {
        if (n < k || n < 0 || k < 0)
            return 0;
        return fact_[n] * finv_[k] * finv_[n - k];
    }
    constexpr T fact(int n) const noexcept
    {
        if (n < 0)
            return 0;
        return fact_[n];
    }
    constexpr T inv(int n) const noexcept
    {
        if (n < 0)
            return 0;
        return inv_[n];
    }
    constexpr T finv(int n) const noexcept
    {
        if (n < 0)
            return 0;
        return finv_[n];
    }
};

const LL mod = 1e9 + 7;
BiCoef<mint<mod>> bc;

void solve()
{
    bc.init(3e6 + 1);
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    r2++;
    c2++;

    cout << bc.com(r2 + c2, c2) - bc.com(r2 + c1, c1) - bc.com(r1 + c2, c2) + bc.com(r1 + c1, c1) << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}

Measured memory_bytes: 70528