object Main extends App {
  val Array(r1, c1, r2, c2) = io.StdIn.readLine().split(' ').map(_.toInt)

  def prod(l: Int, r: Int): Int = {
    if (l > r) 1
    else if (l == r) l;
    else if (r - l == 1) l * r;
    else {
      val m = (l + r) / 2
      prod(l, m) * prod(m+1, r)
    }
  }
  def fact(n: Int): Int = {
    if (n < 0)  0
    else if (n == 0) 1
    else if (n == 1 || n == 2) n
    else prod(2, n);
  }

  val ans = List((r1,c1), (r1,c2), (r2,c1), (r2,c2)).map{case (r,c) =>
    fact(r+c) / (fact(r) * fact(c))
  }.sum
  println(ans)
}