let n = read_int ()
let sumCanDivide m n = n*(m/n)*((m/n)+1)/2
let rec sum n = if n mod 2 = 0 then (1+n)*(n/2) else (1+n)*(n/2)+(n/2)+1
let ans = (sum n) - (sumCanDivide n 3) - (sumCanDivide n 5) + (sumCanDivide n 15)
let () = print_int ans