b=[0]*2001
for i in range(1001):
    for j in range(1001):
        b[i+j]+=1
while 1:
    try:n=int(input())
    except:break
    c=0;a=[1000,n][n<1000]
    for i in range(2*a+1):
        for j in range(2*a+1):
            if i+j==n:c+=b[i]*b[j]
    print(c)