f = lambda x: x+1 if x<=1000 else 2001-x
while 1:
    try:
        n = input(); p = min(n, 2000); ans = 0;
        for i in xrange(n-p,p+1):
            ans += f(i)*f(n-i);
        print ans
    except EOFError:
        break