#light

open System

let N = Console.ReadLine() |> int64

let mutable sum: int64 = 0L

printfn "N: %d" N

for n in 1L .. N do
    if (n%3L=0L) || (n%5L=0L) then 
        sum <- sum
    else 
        sum <- sum + n

printfn "%d" sum
