#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1e9+7;
const int INF=1e9;
const ll LINF=(ll)1e18;

struct Combination{
    vector<ll> fac,finv,inv;
    Combination(int mx){init(mx);}
    void init(int mx){
        fac.resize(mx+1);
        finv.resize(mx+1);
        inv.resize(mx+1);
        fac[0]=fac[1]=1;
        finv[0]=finv[1]=1;
        inv[1]=1;
        for(int i=2;i<=mx;i++){
            fac[i]=fac[i-1]*i%MOD;
            inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
            finv[i]=finv[i-1]*inv[i]%MOD;
        }
    }
    ll calc(int n,int k){
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
    }
};

int main(){
    Combination comb(2000010);
    int r1,r2,c1,c2;
    cin>>r1>>c1>>r2>>c2;
    ll ans=comb.calc(r2+c2+2,r2+1)-comb.calc(r1-1+c2+2,r1-1+1)-comb.calc(r2+c1-1+2,r2+1)+comb.calc(r1-1+c1-1+2,r1-1+1);
    cout<<(ans+MOD)%MOD<<endl;
}
