import strscans

let
  (_, a, b, c, d) = stdin.readAll.scanTuple"$i $i $i $i"
  x = b - a.pred
  y = d - c.pred

if b < c:
  echo x * y
  quit()

let
  z = b - c.pred

echo x * y - z