#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
using namespace std;

const long long mod = 1e9 + 7;

long long r1, r2, c1, c2;

long long power(long long m, long long k) {
	m %= mod;
	int res = 1;
	while (k) {
		if (k & 1) res = res * m % mod;
		m = m * m % mod;
		k >>= 1;
	}
	return res;
}

long long check(long long n, long long m) {
	if (n < m)
		return 0;

	long long res = 1;
	for (int i = 1; i <= m; i++)
		res = res * (n - i + 1) % mod * power(i, mod - 2) % mod;
	return res;
}

int main() {
	cin >> r1 >> c1 >> r2 >> c2;

	r2++, c2++;
	cout << (((check(r2 + c2, c2) - check(r1 + c2, c2) - check(r2 + c1, c1) + check(r1 + c1, c1)) % mod + mod) % mod) << endl;

	return 0;
}
