output_description: Print the sum of f(i, j) modulo (10^9+7).
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      r_1 c_1 r_2 c_2
attempt: # -*- coding: utf-8 -*-
  import sys
  
  # sys.setrecursionlimit(10**6)
  # buff_readline = sys.stdin.buffer.readline
  buff_readline = sys.stdin.readline
  readline = sys.stdin.readline
  
  INF = 2**62 - 1
  
  
  def read_int():
      return int(buff_readline())
  
  
  def read_int_n():
      return list(map(int, buff_readline().split()))
  
  
  def read_float():
      return float(buff_readline())
  
  
  def read_float_n():
      return list(map(float, buff_readline().split()))
  
  
  def read_str():
      return readline().strip()
  
  
  def read_str_n():
      return readline().strip().split()
  
  
  def error_print(*args):
      print(*args, file=sys.stderr)
  
  
  def mt(f):
      import time
  
      def wrap(*args, **kwargs):
          s = time.time()
          ret = f(*args, **kwargs)
          e = time.time()
  
          error_print(e - s, "sec")
          return ret
  
      return wrap
  
  
  class Combination:
      def __init__(self, n, mod):
  
          g1 = [1, 1]
          g2 = [1, 1]
          inverse = [0, 1]
          for i in range(2, n + 1):
              g1.append((g1[-1] * i) % mod)
              inverse.append((-inverse[mod % i] * (mod // i)) % mod)
              g2.append((g2[-1] * inverse[-1]) % mod)
          self.MOD = mod
          self.N = n
          self.g1 = g1
          self.g2 = g2
          self.inverse = inverse
  
      def __call__(self, n, r):
          if r < 0 or r > n:
              return 0
          r = min(r, n - r)
          return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD
  
  
  class Mod:
      def __init__(self, m):
          self.m = m
  
      def add(self, a, b):
          return (a + b) % self.m
  
      def sub(self, a, b):
          return (a - b) % self.m
  
      def mul(self, a, b):
          return ((a % self.m) * (b % self.m)) % self.m
  
      def div(self, a, b):
          return self.mul(a, pow(b, self.m - 2, self.m))
  
      def pow(self, a, b):
          return pow(a, b, self.m)
  
  
  @mt
  def slv(R1, C1, R2, C2):
      C = Combination(2 * 10**6, 10**9 + 7)
      M = Mod(10**9 + 7)
      ans = 0
      for r in range(R1, R2 + 1):
          a = C(C2 + r + 1, r + 1)
          b = C(C1 - 1 + r + 1, r + 1)
          ans = M.add(ans, M.sub(a, b))
      return ans
  
  
  def main():
      R1, C1, R2, C2 = read_int_n()
      print(slv(R1, C1, R2, C2))
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  Snuke is standing on a two-dimensional plane. In one operation, he can move by
  1 in the positive x-direction, or move by 1 in the positive y-direction.
  
  Let us define a function f(r, c) as follows:
  
    * f(r,c) :=  (The number of paths from the point (0, 0) to the point (r, c) that Snuke can trace by repeating the operation above)
  
  Given are integers r_1, r_2, c_1, and c_2. Find the sum of f(i, j) over all
  pair of integers (i, j) such that r_1 ≤ i ≤ r_2 and c_1 ≤ j ≤ c_2, and compute
  this value modulo (10^9+7).
samples: [{"input": "1 1 2 2", "output": "14\n    \n\nFor example, there are two paths from the point (0, 0) to the point (1, 1):\n(0,0) \u2192 (0,1) \u2192 (1,1) and (0,0) \u2192 (1,0) \u2192 (1,1), so f(1,1)=2.\n\nSimilarly, f(1,2)=3, f(2,1)=3, and f(2,2)=6. Thus, the sum is 14.\n\n* * *"}, {"input": "314 159 2653 589", "output": "602215194"}]