fun main(args: Array<String>) {

    val input = readLine()
    var n:Int = Integer.parseInt(input)
    var sum:Long = 0

    for(i in 1 until n+1){
        val tmp = if(i % 3 == 0) 0 else if(i % 5 == 0) 0 else i
        sum += tmp
    }
    println(sum)
}