A = [0 for i in range(2001)]
        
for i in range(1001) :
    for j in range(1001) :
        A[i + j] += 1

while True :
    try :
        n = int(input())
                
        cnt = 0
        
        if(n > 4000) :
            print(0)
            
        elif(n > 2000) :
            for i in range(n - 2000, 2001) :
                cnt += A[i] * A[n - i]
            print(cnt)
                
        else :
            for i in range(n + 1) :
                cnt += A[i] * A[n - i]
            print(cnt)
       
    except :
        break


