fun main(args: Array<String>) {
  val input1 = readLine()!!.toInt()
  var result = 0L
  for (i in 1..input1) {
    when {
      i % 15 == 0 || i % 5 == 0 || i % 3 == 0 -> {
      }
      else -> {
        result += i.toLong()
      }
    }
  }
  println(result)
}
