defmodule Main do def main do IO.gets("") |> String.trim |> String.split |> Enum.map(&String.to_integer/1) |> pokky(0) |> IO.puts end def pokky([l, k], acc) when l-k*2 > 0 do pokky([l-k*2, k], acc+k) end def pokky([_, _], acc) do acc end end