import java.util.Scanner

object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val a = sc.nextInt //最初の整数が読み込まれる
    
    var b = 0
    
    (1 to a).foreach{j =>
      j match{
      	case j if j%15 == 0 => b = b
        case j if j%3 == 0 => b = b
        case j if j%5 == 0 => b = b
        case _ => b = b + j
      }
    }
     println(b)
  }
}
