fun main() {
    val n = readLine()?.toInt() ?: return
    var total = 0L
    repeat(n) {
        val value = it + 1
        total += if (value % 15 == 0 || value % 3 == 0 || value % 5 == 0) {
            0
        } else {
            value
        }
    }
    println(total)
}
