fun main() {
    val n = readLine()!!.toInt()
    val fbList = mutableListOf<String>()
    val nfbList = mutableListOf<Long>()

        for(i in 1L .. n){
            if(i % 3 != 0L && i % 5 != 0L){
                nfbList.add(i)
            }else{
                fbList.add("piyo")
            }
        }



    println(nfbList.sum())
}