#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

ll r1, c1, r2, c2, M=1e9+7;

ll pow(ll p, ll q) {
	if(q==0) return 1;
	ll t = pow(p, q/2);
	return t * t % M * (q%2 ? p : 1) % M;
}

ll C(ll p, ll q) {
	ll x=1, y=1;
	for(ll i=0; i<q; i++) {
		x = x * (p-i) % M;
		y = y * (i+1) % M;
	}
	return x * pow(y, M-2) % M;
}

int main() {
	cin >> r1 >> c1 >> r2 >> c2;
	r2++; c2++;
	cout << (C(r2+c2, r2) - C(r2+c1, c1) - C(r1+c2, r1) + C(r1+c1, r1) + 2*M) % M;
	return 0;
}