#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007
using namespace std;
ll r1, r2, c1, c2, ans, arr[2000020];
ll g(ll, ll);
ll f(ll, ll);
ll cal(ll, ll);
int main()
{
	ios::sync_with_stdio(false);
	arr[0] = 1;
	for(ll i = 1; i<=2000010; ++i) arr[i] = arr[i-1]*i%MOD;
    cin>>r1>>c1>>r2>>c2;
	ans = g(r2, c2)-g(r1-1, c2)-g(r2, c1-1)+g(r1-1, c1-1);
	ans = (ans+MOD)%MOD;
	cout<<ans<<"\n";
}

ll g(ll a, ll b)
{
	ll sum = 0;
	for(ll i = 1; i<=a+1; ++i) 
		sum+=f(i, b)%MOD;
	return sum%MOD;
}

ll f(ll a, ll b)
{
	//(a+b)!/a!/b!;
	return arr[a+b]*cal(arr[a], MOD-2)%MOD*cal(arr[b], MOD-2)%MOD;
}

ll cal(ll a, ll b)
{
	if(b==0) return 1;
	if(b%2) return a*cal(a*a%MOD, b/2)%MOD;
	return cal(a*a%MOD, b/2);
}