defmodule Main do
  def main do
    a = IO.read(:line) |> String.trim |> String.to_integer();
    sum = Enum.filter(1..a, fn(x) -> rem(x, 3)!=0 and rem(x, 5)!=0 end)
    IO.puts(Enum.sum(sum))
  end
end