fun main(args: Array<String>){
    val X = readLine()!!.toLong()
    var i_sum: Long = 0
    for(i in 1..X){
        if(i % 5 == 0L && i % 3 == 0L){
            continue
        }else if(i % 3 == 0L){
            continue
        }else if(i % 5 == 0L){
            continue
        }else{
            i_sum += i
        }
    }
    
    

    println(i_sum)
}
