import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val s = scanner.next()!!
    val n = Integer.parseInt(s).toLong()
    val sum = (0..n).reduce { acc, i ->
        acc + when (i % 3 == 0.toLong() || i % 5 == 0.toLong()) {
            true -> 0
            else -> i
        }
    }
    println(sum)
}
