defmodule Main do def main do IO.gets("") |> String.split() |> Enum.map(&String.to_integer(&1)) |> (fn [a, b, c, d] -> (b - a + 1) * (d - c + 1) - cond do b < c -> 0 true -> min(b, d) - max(a, c) + 1 end end).() |> IO.puts() end end