defmodule Main do def venn([0, 0, 0], [a, _, _], i), do: div(i, a) def venn([0, 0, _], [a, b, _], i), do: div(i, a) + div(i, b) - div(i, a*b) def venn([0, _, 0], [a, _, c], i), do: div(i, a) + div(i, c) - div(i, a*c) def venn([0, _, _], [a, b, _], i), do: div(i, a) + div(i, b) - div(i, a*b) def venn([_, 0, 0], [a, _, _], i), do: div(i, a) def venn([_, 0, _], [a, b, _], i), do: div(i, a) + div(i, b) - div(i, a*b) def venn([_, _, 0], [c, _, a], i), do: div(i, a) + div(i, c) - div(i, a*c) def venn([_, _, _], [c, b, a], i), do: div(i, a) + div(i, b) + div(i, c) - div(i, a*b) - div(i, a*c) - div(i, b*c) + div(i, a*b*c) def main do i = IO.gets("") |> String.trim |> String.to_integer ls = IO.gets("") |> String.trim |> String.split |> Enum.map(&String.to_integer/1) [a, b, c] = Enum.sort(ls) venn([rem(c, b), rem(c, a), rem(b, a)], [a, b, c], i) |> IO.puts end end