#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 2000020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}

ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}

ll f(int x, int y) {
	ll ans = mult(fac[x + y], finv[x]);
	ans = mult(ans, finv[y]);
	return ans;
}
ll cum[2000020];
ll g(int N, int M) {
	ll ans = 0;
	if (N > M)swap(N, M);
	ans += mult(mult(N, M), N);
	ll c = (N - 1)*N / 2;
	c %= MOD;
	ans = sub(ans, mult(c, (N + M) % MOD));
	ans = add(ans, sub(cum[N - 1], cum[0]));
	return ans;
}
void solve() {
	int r1, r2, c1, c2; cin >> r1 >> c1 >> r2 >> c2;
	COMinit();
	ll ans = 0;
	FOR(i, 1, 1e6 + 1) {
		cum[i] += cum[i - 1];
		cum[i] = mult(i, i);
	}
	ll sum = 0;
	FORR(y, c2+1, c1) {
		ll tmp = f(r1 - 1, y);
		int N = c2 - y + 1;
		int M = r2 - r1 + 1;
		sum += f(N , M-1);
		sum %= MOD;
		ans += mult(tmp, sum);
		ans %= MOD;
	}
	sum = 0;
	FORR(x, r2+1, r1) {
		ll tmp = f(x, c1 - 1);
		int N = r2 - x + 1;
		int M = c2 - c1 + 1;
		sum += f(N , M-1);
		sum %= MOD;
		ans += mult(tmp, sum);
		ans %= MOD;
	}
	print(ans);
}

signed main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}

Measured memory_bytes: 56576