/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-02-09 20:13:02
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

class Combination {
 public:
  //constexpr 
  Combination() { Build(); }
  static constexpr int mod_ = 1000000007;
  static constexpr int n_ = 2000000 + 10;
  struct LookupTable {
    int64 factorial_[n_];
    int64 inverse_[n_];
    int64 finverse_[n_];
  };
  LookupTable lt{};

  // return nCk
  //constexpr 
  int64 Get(int64 n, int64 k) const noexcept {
    if (n < k || n < 0 || k < 0) return 0;
    return lt.factorial_[n] * (lt.finverse_[k] * lt.finverse_[n - k] % mod_) %
           mod_;
  }

 private:
  //constexpr 
  void Build() noexcept {
    lt.factorial_[0] = 1;
    lt.factorial_[1] = 1;
    lt.finverse_[0] = 1;
    lt.finverse_[1] = 1;
    lt.inverse_[1] = 1;
    for (int i = 2; i < n_; ++i) {
      lt.factorial_[i] = lt.factorial_[i - 1] * i % mod_;
      lt.inverse_[i] = mod_ - lt.inverse_[mod_ % i] * (mod_ / i) % mod_;
      lt.finverse_[i] = lt.finverse_[i - 1] * lt.inverse_[i] % mod_;
    }
  }
};

constexpr int64 MOD = 1e9 + 7;

Combination kyomu;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

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

  int64 ans = 0;

  for (int64 i = r1; i <= r2; ++i) {
    ans += (((c2 + 1LL) * kyomu.Get(c2 + i + 1LL, i) % MOD) * kyomu.lt.inverse_[i + 1]) % MOD - ((c1 * kyomu.Get(c1 + i, i) % MOD) * kyomu.lt.inverse_[i + 1] % MOD);
    while (ans < 0) ans += MOD;
    ans %= MOD;
  }


/*
  for (int64 i = r1; i <= r2; ++i) {
    for (int64 j = c1; j <= c2; ++j) {
      ans += kyomu.Get(i + j, i);
      ans %= MOD;
    }
  }
*/

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 47104