import java.util.Scanner


object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    var ans: BigInt = 0
    for (i <- 0 to n) {
      (i % 3, i % 5) match {
        case (0, 0) => ()
        case (0, _) => ()
        case (_, 0) => ()
        case _ => ans += i
      }
    }
    println(ans)
  }
  
  def printArray[T](arr: Array[T]): Unit = {
    for (i <- arr.indices) {
      print(s"${arr(i)} ")
    }
    println()
  }
}