#include <iostream>
#define mod 1000000007
using namespace std;
int inv[2000005],jc[2000005],jcinv[2000005];
inline int C(int x,int y)
{
	return (long long)jc[x]*jcinv[y]%mod*jcinv[x-y]%mod;
}
inline int cal(int x,int y)
{
	int rtn=0;
	for(int i=1;i<=y+1;i++)
		rtn=(rtn+C(i+x,i))%mod;
	return rtn;
}
int main(int argc, char** argv) {
	inv[1]=jc[0]=jc[1]=jcinv[0]=jcinv[1]=1;
	for(int i=2;i<=2000004;i++)
	{
		jc[i]=(long long)jc[i-1]*i%mod;
		inv[i]=(long long)(mod-mod/i)*inv[mod%i]%mod;
		jcinv[i]=(long long)jcinv[i-1]*inv[i]%mod;
	}
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	cout << ((cal(c,d)-cal(c,b-1)-cal(a-1,d)+cal(a-1,b-1))%mod+mod)%mod;
	return 0;
}