object Main {
    def main(args:Array[String]) = {
        val dp = Array.ofDim[Int](4001)
        val elem = Array.tabulate(4001)(_ => 1)
        for(k <- 1 to 3) {
            for(i <- 0 to k * 1000) {
                for(j <- 0 to 1000) {
                    dp(i + j) += elem(i)
                }
            }
            for(i <- 0 to (k + 1) * 1000) {
                elem(i) = dp(i)
                dp(i) = 0
            }
        }
        val sc = new java.util.Scanner(System.in)
        while(sc.hasNextInt) {
            val n = sc.nextInt
            println(elem(n))
        }
    }
}