import Foundation

let input:Int = Int(readLine()!)!

func add(num: Int) -> Int {
  (num + 1) * (num) / 2
}
let number = add(num:input) + 15 * add(num: input / 15) - 3 * add(num: input / 3) - 5 * add(num: input / 5)
print( number )
