defmodule Main do def main do IO.read(:line) |> String.split() |> Enum.map(&String.to_integer/1) |> solve |> IO.puts() end defp solve([n, h, m, t]) do [(h + (m |> div(60))) |> rem(24), (m + (n - 1) * t) |> rem(60)] |> Enum.join("\n") end end