import sys
table = [0] * 2001
for i in xrange(1001):
    for ii in xrange(1001):
        table[i+ii] += 1
for line in sys.stdin.readlines():
    count = 0
    n = int(line.strip())
    for i in xrange(2001 if n+1 > 2001 else n+1):
        if not n-i > 2000:
            count += table[n-i] * table[i]
    print count
        