defmodule Main do
  def main do
    a = IO.read(:line) |> String.trim
    b = IO.read(:line) |> String.trim
    c = IO.read(:line) |> String.trim
    d = IO.read(:line) |> String.trim
    a = String.to_integer(a)
    b = String.to_integer(b)
    c = String.to_integer(c)
    d = String.to_integer(d)
    IO.puts(Enum.min([a,b]) + Enum.min([c,d]))
  end
end
