ans = [0 for i in range(4001)]

for i in range(2001):
    if i > 1000:
        a = a + 2*(i - 999)*(i - 1000)
    else:
        a = 0
    ans[i] = (i + 3)*(i + 2)*-~i//6 - a
    ans[4000 - i] = ans[i]

while True:
    try:
        n = int(input())
        print(ans[n])
    except:
        break

