while True:
    try:
        n = int(input())
        if n > 2000:
            n = 4000 - n

        ans = (n+1)*(n+2)*(n+3)/6
        if n >= 1001:
            n = n - 1001
            ans = ans - 2*(n+1)*(n+2)*(n+3)/3

        print(int(ans))

    except EOFError:
        break
