open Printf
open Scanf

let solve n =
  let sum_mult x y =
    let i = x / y in
    i * (i + 1) / 2 * y in
  sum_mult n 1 + sum_mult n 15 - sum_mult n 3 - sum_mult n 5

let () =
  scanf "%d " solve |> printf "%d\n"
