#include <bits/stdc++.h>
using namespace std;
long long fac[2000002];
long long poweeer(long long x, long long y) {
  int res = 1;
  long long p = 1000000007;
  ;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long formula(long long n, long long m) {
  return (fac[n + m] * poweeer((fac[n] * fac[m]), 1000000005)) % 1000000007;
  ;
}
int main() {
  long long x1, x2, y1, y2;
  cin >> x1;
  cin >> y1;
  cin >> x2;
  cin >> y2;
  long long k = 1, ans = 0;
  for (int i = 1; i <= (y2 + x2 + 2); i++) {
    k = (k * i) % 1000000007;
    ;
    fac[i] = k;
  }
  fac[0] = 1;
  for (long long i = y1; i <= y2; i++) {
    ans = (ans + formula(x2, i + 1)) % 1000000007;
    ;
  }
  for (long long i = y1; i <= y2; i++) {
    ans = (ans - formula(x1 - 1, i + 1)) % 1000000007;
    ;
  }
  cout << endl << ans << endl;
}
