def Kosuu(n,sak):
    if n <= sak:
        kazu = n + 1
        sta = 0
        end = n
    else:
        kazu = sak * 2 + 1 - n
        sta = n - sak
        end = sak
    return [kazu,sta,end]
    
while True:
    try:
        Sum = 0
        n = int(input())
        ABl = Kosuu(n,2000)
        
        for i in range(ABl[1],ABl[2] + 1):
            Sum += Kosuu(i,1000)[0] * Kosuu(n -i,1000)[0]
        print(Sum)
    except EOFError:
        break
            