#include <bits/stdc++.h>

using namespace std;
using ll = long long;

template <int T_MOD>
struct ModInt {
  static constexpr int MOD = T_MOD;
private:
  using ll = long long;
  int v;

  static int minv(int a, int m) {
    a %= m;
    if (a < 0) a += m;
    int b = m, u = 0, v = 1;
    while (a) {
      int t = b / a;
      b -= t * a; swap(a, b);
      u -= t * v; swap(u, v);
    }
    assert(b == 1);
    if (u < 0) u += m;
    return u;
  }

public:

  ModInt() : v(0) {}
  template<class T> ModInt(T v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
  explicit operator int() const { return v; }
  friend std::ostream& operator << (std::ostream& out, const ModInt& n) { return out << int(n); }
  friend std::istream& operator >> (std::istream& in, ModInt& n) { ll v_; in >> v_; n = ModInt(v_); return in; }
  friend bool operator == (const ModInt& a, const ModInt& b) { return a.v == b.v; }
  friend bool operator != (const ModInt& a, const ModInt& b) { return a.v != b.v; }

  ModInt inv() const {
    ModInt res;
    res.v = minv(v, MOD);
    return res;
  }

  ModInt neg() const {
    ModInt res;
    res.v = v ? MOD - v : 0;
    return res;
  }

  ModInt operator- () const {
    return neg();
  }

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

  ModInt& operator ++ () {
    v++;
    if (v == MOD) v = 0;
    return *this;
  }

  ModInt& operator -- () {
    if (v == 0) v = MOD;
    v --;
    return *this;
  }

  ModInt& operator += (const ModInt& o) {
    v += o.v;
    if (v >= MOD) v -= MOD;
    return *this;
  }

  ModInt& operator -= (const ModInt& o) {
    v -= o.v;
    if (v < 0) v += MOD;
    return *this;
  }

  ModInt& operator *= (const ModInt& o) {
    v = int(ll(v) * ll(o.v) % MOD);
    return *this;
  }

  ModInt& operator /= (const ModInt& o) {
    return *this *= o.inv();
  }

  friend ModInt operator ++ (ModInt& a, int) { ModInt r = a; ++a; return r; }
  friend ModInt operator -- (ModInt& a, int) { ModInt r = a; --a; return r; }
  friend ModInt operator + (const ModInt& a, const ModInt& b) { return ModInt(a) += b; }
  friend ModInt operator - (const ModInt& a, const ModInt& b) { return ModInt(a) -= b; }
  friend ModInt operator * (const ModInt& a, const ModInt& b) { return ModInt(a) *= b; }
  friend ModInt operator / (const ModInt& a, const ModInt& b) { return ModInt(a) /= b; }  
};

const int mod = 1000000007;
using Mint = ModInt<mod>;

Mint power(Mint x, int p) {
  Mint ans = Mint(1);
  while(p) {
    if(p & 1) {
      ans *= x;
    }
    x *= x;
    p >>= 1;
  }
  return ans;
}

const int MAXN = 5.01e6;
Mint fact[MAXN], ifact[MAXN];

void prepare_factorial() {
  fact[0] = 1;
  for(int i = 1; i < MAXN; ++i) {
    fact[i] = fact[i - 1] * Mint(i);
  }
  ifact[MAXN - 1] = 1 / fact[MAXN - 1];
  for(int i = MAXN - 2; i >= 0; --i) {
  ifact[i] = ifact[i + 1] * Mint(i + 1);
  }
}

Mint C(int n, int r) {
  if(min(n, r) < 0 || n < r) return Mint(0);
  return fact[n] * (ifact[n - r] * ifact[r]);
}

Mint P(int n, int r) {
  if(min(n, r) < 0 || n < r) return Mint(0);
  return fact[n] * ifact[n - r];
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  prepare_factorial();
  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  Mint res = 0;
  Mint res2 = 0;
  for(int i = c1; i <= c2; ++i) {
    res2 += C(r2 + i + 1, i + 1) - C(r1 + i, i + 1);
    /*
    for(int j = r1; j <= r2; ++j) {
      mp[{i + j, i}]++;
      res += C(i + j, i);
    }
    */
  }
  // cout << res << ' ' << res2 << '\n';
  cout << res2 << '\n';
  return 0;
}


Measured memory_bytes: 39424