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