import sys
hist = [0 for i in range(4001)]
for i in range(1001):
    for j in range(1001):
        hist[i + j] += 1

for line in sys.stdin:
    ans = 0
    n = int(line)
    for i in range(min(n, 2000) + 1):
        ans += (hist[i] * hist[n-i])
    print(ans)
