import Foundation

let input = Int(readLine()!)!
var array:[Int] = []
var total = 0

for i in 1...input {
    array.append(i)
    if array[i-1] % 5 == 0 || array[i-1] % 3 == 0{
        array[i-1] = 0
    }
    total += array[i-1]
}
print(total)