#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <complex>
 
 
using namespace std;
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
 
 
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
 
const int MOD =  1e9 + 7; 
 
 
 
ll power(ll a, ll b){
	if(b == 0) return 1;
	else {
		ll x = power(a,b/2);
		x = (x*x)%MOD;
		if(b&1) return (x*a)%MOD;
		else return x;
	}
}
 
 
ll& Mod(ll& a) {
	
    if (a >= MOD) {
        return Mod(a -= MOD);
    } else if (a < 0) {
        return Mod(a += MOD);
    } else {
        return a;
    }
}
 
ll gcd(ll a, ll b) { 
	// b < a
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 


const int N = 2e6 + 10;
ll fact[N];
ll i_fact[N];

void precompute(){
	fact[0] = 1;
	for(int i = 1; i < N; i++){
		fact[i] = (fact[i-1]*i)%MOD;
	}
	
	i_fact[N-1] = power(fact[N-1], MOD - 2);
	
	for(int i = N-2; i >= 0; i--){
		i_fact[i] = ((i+1) * i_fact[i+1])%MOD;
	}
}

ll ncr(int n, int r){
	return (((fact[n]*i_fact[r])%MOD)*i_fact[n-r])%MOD;
}


ll sum(ll r, ll c){
	
	if(r > c) swap(r, c);
	
	
	ll tot = 0;
	for(int i = 0; i <= r + c; i++){
		Mod(tot += (power(2, i)));		
	}
	
	
	ll fx = 0;  
	ll gx = -1;
	ll val;
	ll val2;
	for(int x = 1; x <= c; x++){ 
		if(r + x - c - 1 == 0){
			gx = 0;
		}
		Mod(tot -= (gx + 1));
		Mod(tot -= (fx + 1));
		
		val = ncr(r + x, x) + 1;	
		//debug(fx, r + x, x, val);
		fx = (2*fx + val)%MOD; // f(x + 1)
		if(gx >= 0){
			val2 = ncr(r + x, r + x - c) + 1;	
			gx = (2*gx + val2)%MOD;
		}
	}
	
	return tot;

}


int main() {
	fast_cin();	
	
	precompute();
	
	ll r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
	
	ll a1 = sum(r2, c2) - sum(r2, c1-1) - sum(r1-1, c2) + sum(r1 - 1, c1 - 1); 
	
	Mod(a1);
	
	cout << a1 << '\n';
	
	
	
	
	
	
	
		
}


Measured memory_bytes: 31488