fun main (args:Array<String>){
    val a = readLine()!!.toInt()
    var num = 0L
    for (i in 1..a)  {
        if(i % 3 == 0){
            continue
        }
        if(i % 5 == 0){
            continue
        }
        num += i
    }
    print(num)
}
