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

const long mod = 1000000007;
long fact(long n) {
  return n == 0 ? 1 : n * fact(n - 1) % mod;
}

long mpow(long b, long e) {
  if (e == 0) return 1;
  if (e % 2 == 1) return b * mpow(b, e - 1) % mod;
  long t = mpow(b, e / 2);
  return t * t % mod;
}

long inv(long n) {
  return mpow(n, mod - 2);
}

long sub(int m, int n) {
  return fact(m + n) * inv(fact(m) * fact(n) % mod) % mod;  
}

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  long sum = (
    sub(a, b)
    - sub(a, d + 1)
    - sub(c + 1, b)
    + sub(c + 1, d + 1)
    + 4 * mod
    ) % mod;
  cout << sum << endl;
}