dp=[0]*4001
for i in range(4001):
    if i<1000:
        dp[i]=i+1
    elif i>2000:
        dp[i]=0
    elif i>=1000:
        dp[i]=2001-i
while 1:
    try:
        ans=0
        n=int(input())
        for i in range(n+1):
            ans+=dp[i]*dp[n-i]
        print(ans)
    except:break
