fun main(args: Array<String>) {
    readLine()?.toLong()?.let {
        var count = 0L
        for (i in 1..it) {
            if (i.rem(5) == 0L || i.rem(3) == 0L){
            } else {
                count += i
            }
        }
        println(count)
    }
}