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 a = m + (n - 1) * t [(h + (a |> div(60))) |> rem(24), a |> rem(60)] |> Enum.join("\n") end end