import sys
def N(n):
    return (n+1)*(n+2)*(n+3)/6
for n in sys.stdin:
        n = int(raw_input())
        if n > 2000:
            n = 4000 - n
        if n < 1001:
            print N(n)
        else:
            m = n - 1000
            print N(n) - (N(2*m) - m - 1)/2