#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define S second
#define mod 1000000007
#define int long long
using namespace std;
int k[3000000];
int mypow(int a, int b, int c) {
	if (b == 0)return 1;
	if (b % 2)return mypow(a, b - 1, c)*a%c;
	int z = mypow(a, b / 2, c);
	return z * z%c;
}
int nCr(int a, int b) {
	if (b < 0 || a < b)return 0;
	return k[a] * mypow(k[a - b], mod - 2, mod) % mod*mypow(k[b], mod - 2, mod) % mod;
}
signed main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	k[0] = 1;
	f(i, c + d + 2) {
		k[i + 1] = k[i] * (i + 1) % mod;
	}
	cout << (nCr(a + b, a) + nCr(c + d + 2, c + 1) - nCr(a + d + 1, a) - nCr(b + c + 1, b) + mod + mod) % mod << endl;
}
