#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

template <std::size_t MOD> class ModuloInteger
{
public:
    ModuloInteger(const std::size_t init)
        : value(init)
    {
    }

    using value_t = std::size_t;

    ModuloInteger operator+(const ModuloInteger value) const noexcept;
    void operator+=(const ModuloInteger value) noexcept;

    ModuloInteger operator-(const ModuloInteger value) const noexcept;
    void operator-=(const ModuloInteger value) noexcept;

    ModuloInteger operator*(const ModuloInteger value) const noexcept;
    void operator*=(const ModuloInteger value) noexcept;

    ModuloInteger operator/(const ModuloInteger value) const noexcept;
    void operator/=(const ModuloInteger value) noexcept;

    ModuloInteger operator+(const std::size_t value) const noexcept;
    void operator+=(const std::size_t value) noexcept;

    ModuloInteger operator-(const std::size_t value) const noexcept;
    void operator-=(const std::size_t value) noexcept;

    ModuloInteger operator*(const std::size_t value) const noexcept;
    void operator*=(const std::size_t value) noexcept;

    ModuloInteger operator/(const std::size_t value) const noexcept;
    void operator/=(const std::size_t value) noexcept;

    ModuloInteger inv() const noexcept;

    ModuloInteger powi(const std::size_t index) const noexcept;

    std::size_t value;
};

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::powi(const std::size_t index) const noexcept
{
    if (index == 0)
    {
        return 1;
    }
    else if (index == 1)
    {
        return *this;
    }
    else if (index % 2 == 0)
    {
        auto v = powi(index / 2);
        return v * v;
    }
    else
    {
        return powi(index - 1) * (*this);
    }
}

template <std::size_t MOD> ModuloInteger<MOD> fact(const std::size_t n)
{
    ModuloInteger<MOD> ret(1);
    for (int i = 1; i <= n; i++)
    {
        ret *= i;
    }
    return ret;
}

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::inv() const noexcept { return powi(MOD - 2); }

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::operator+(const ModuloInteger value) const noexcept
{
    return (this->value + value.value) % MOD;
}

template <std::size_t MOD> void ModuloInteger<MOD>::operator+=(const ModuloInteger value) noexcept
{
    this->value = (this->value + value.value) % MOD;
}

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::operator-(const ModuloInteger value) const noexcept
{
    return (this->value + MOD - value.value) % MOD;
}

template <std::size_t MOD> void ModuloInteger<MOD>::operator-=(const ModuloInteger value) noexcept
{
    this->value = (this->value + MOD - value.value) % MOD;
}

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::operator*(const ModuloInteger value) const noexcept
{
    return (this->value * value.value) % MOD;
}

template <std::size_t MOD> void ModuloInteger<MOD>::operator*=(const ModuloInteger value) noexcept
{
    this->value = (this->value * value.value) % MOD;
}

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::operator/(const ModuloInteger value) const noexcept
{
    return (this->value * value.inv().value) % MOD;
}

template <std::size_t MOD> void ModuloInteger<MOD>::operator/=(const ModuloInteger value) noexcept
{
    this->value = (this->value * value.inv().value) % MOD;
}

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::operator+(const std::size_t value) const noexcept
{
    return (this->value + value) % MOD;
}

template <std::size_t MOD> void ModuloInteger<MOD>::operator+=(const std::size_t value) noexcept
{
    this->value = (this->value + value) % MOD;
}

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::operator-(const std::size_t value) const noexcept
{
    return (this->value + MOD - value) % MOD;
}

template <std::size_t MOD> void ModuloInteger<MOD>::operator-=(const std::size_t value) noexcept
{
    this->value = (this->value + MOD - value) % MOD;
}

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::operator*(const std::size_t value) const noexcept
{
    return (this->value * value) % MOD;
}

template <std::size_t MOD> void ModuloInteger<MOD>::operator*=(const std::size_t value) noexcept
{
    this->value = (this->value * value) % MOD;
}

template <std::size_t MOD> ModuloInteger<MOD> ModuloInteger<MOD>::operator/(const std::size_t value) const noexcept
{
    return (this->value * ModuloInteger<MOD>(value).inv().value) % MOD;
}

template <std::size_t MOD> void ModuloInteger<MOD>::operator/=(const std::size_t value) noexcept
{
    this->value = (this->value * ModuloInteger<MOD>(value).inv().value) % MOD;
}

template <std::size_t MOD> std::ostream& operator<<(std::ostream& out, const ModuloInteger<MOD> value) noexcept
{
    out << value.value;
    return out;
}

constexpr std::size_t MOD = 1000000007;

using modint = ModuloInteger<MOD>;

modint comb(int n, int r) { return fact<MOD>(n) * fact<MOD>(r).inv() * fact<MOD>(n - r).inv(); }

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

    const auto ans = comb(r2 + c2 + 2, r2 + 1) - comb(r2 + c1 + 1, c1) - comb(r1 + 1 + c2, r1) + comb(r1 + c1, c1);
    cout << ans << endl;
}

Measured memory_bytes: 256