while True:
    try:
        n = int(raw_input())
        count = 0
        for a in range(1000,-1,-1):
             if 0 <= n - a <= 3000:
                for b in range(1000,-1,-1):
                    if n - a - b > 2000:
                        break
                    elif 0 <= n - a - b <= 1000:
                        count += n-a-b+1
                    elif 1001 < n - a - b <= 2000:
                        count += (2000 - (n-a-b) + 1)
        print count
    except:
        break