fun main(args: Array<String>){
    val input = readLine()!!.toLong()
    var res = 0L
    for (i in 1 until input + 1) {
        if (i % 3L != 0L && i % 5L != 0L) {
            res += i
        }
    }
    println(res)
}