open System

let (|FizzBuzz|Fizz|Buzz|Num|) n = 
    match n % 3, n % 5 with 
    | 0, 0 -> FizzBuzz 
    | 0, _ -> Fizz 
    | _, 0 -> Buzz 
    | _ -> Num n 

[1 .. int <| Console.ReadLine()]
|> List.map (function (Num n) -> int64 n | _ -> 0L)
|> List.sum
|> printfn "%i"