import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    var sum: Long = 0
    repeat(n + 1) {
        sum += fizzbuzz(it)
    }
    println(sum)
}

fun fizzbuzz(num: Int): Int {
    return if (num % 3 == 0 && num % 5 == 0) {
        0
    } else if (num % 3 == 0) {
        0
    } else if (num % 5 == 0) {
        0
    } else {
        num
    }
}