fun main(args: Array<String>) {
    val n = readLine()!!.split(" ").map { it.toInt() }[0]
    var count:Long = 0
    for (i in 0..n){
        var iDouble = i.toDouble()
        val threeDouble = 3.toDouble()
        val fiveDouble = 5.toDouble()
        val threeAmari = iDouble % threeDouble
        val fiveAmari = iDouble % fiveDouble
        if (threeAmari != 0.toDouble()){
            if (fiveAmari != 0.toDouble()){
                count += i
            }
        }
    }
    println(count)
}