import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toInt()
    var ans: Long=0
    for(i in 1..kotlin)
    {
        if(i%3==0 || i%5==0)
        {
            continue
        }
        ans+=i
    }
    println(ans)
}
