import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  (r1 : c1 : r2 : c2 : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    s :: Int
    s = foldl step 0 $ (,) <$> [r1..r2] <*> [c1..c2]
      where
        step k (r, c) = (k + f r c) `mod` modulus
  print s

f :: Int -> Int -> Int
f r c = modComb (r + c) r

modInv :: Int -> Int
modInv = (invs VU.!)
  where
    invs :: VU.Vector Int
    invs = VU.constructN (2 * 10 ^ 6 + 1) rec
      where
        rec v = case VU.length v of
          0 -> 0
          1 -> 1
          l -> let (q, r) = modulus `divMod` l in (modulus - (v VU.! r) * q) `mod` modulus

modFact :: Int -> Int
modFact = (facts VU.!)
  where
    facts :: VU.Vector Int
    facts = VU.unfoldrN (2 * 10 ^ 6 + 1) next (0, 0)
      where
        next (0, _) = Just (1, (1, 1))
        next (i, x) = let x' = (x * i) `mod` modulus in Just (x', (succ i, x'))

modFactInv :: Int -> Int
modFactInv = (factInvs VU.!)
  where
    factInvs :: VU.Vector Int
    factInvs = VU.unfoldrN (2 * 10 ^ 6 + 1) next (0, 0)
      where
        next (0, _) = Just (1, (1, 1))
        next (i, x) = let x' = (x * modInv i) `mod` modulus in Just (x', (succ i, x'))

modComb :: Int -> Int -> Int
modComb n k | n < 0 || k < 0 || n < k = 0
            | otherwise               = ((modFact n * modInv (modFact (n - k)) `mod` modulus) * modInv (modFact k)) `mod` modulus

modulus :: Int
modulus = 10 ^ 9 + 7

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
