defmodule Main do def main do [l, k] = IO.gets("") |> String.trim |> String.split |> Enum.map(&String.to_integer/1) case {div(l, 2 * k) * k, rem(l, 2 * k)} do {a, 0} -> a - k {a, _} -> a end |> Integer.to_string |> IO.puts end end