from collections import Counter



two_dict = Counter()



for i in range(1001):

  for j in range(1001):

    two_dict[i + j] += 1



while True:

  try:

    n = int(eval(input()))

    ans = 0

    for i in range(n + 1):

      ans += two_dict[i] * two_dict[n - i]

    print(ans)



  except EOFError:

    break



from collections import Counter



pair_dict = Counter()

for i in range(2001):

  pair_dict[i] = min(i, 2000 - i) + 1 



while True:

  try:

    n = int(eval(input()))

    ans = 0

    for i in range(n + 1):

      ans += pair_dict[i] * pair_dict[n - i]

    print(ans)



  except EOFError:

    break



from collections import Counter

two_dict = Counter()
for i in range(1001):
    for j in range(1001):
        two_dict[i + j] += 1
while True:
    try:
        n = int(eval(input()))
        ans = 0
        for i in range(n + 1):
            ans += two_dict[i] * two_dict[n - i]
        print(ans)
    except EOFError:
        break

from collections import Counter

pair_dict = Counter()
for i in range(2001):
    pair_dict[i] = min(i, 2000 - i) + 1
while True:
    try:
        n = int(eval(input()))
        ans = 0
        for i in range(n + 1):
            ans += pair_dict[i] * pair_dict[n - i]
        print(ans)
    except EOFError:
        break

-two_dict = Counter() -for i in range(1001): -    for j in range(1001): -        two_dict[i + j] += 1 +pair_dict = Counter() +for i in range(2001): +    pair_dict[i] = min(i, 2000 - i) + 1 -            ans += two_dict[i] * two_dict[n - i] +            ans += pair_dict[i] * pair_dict[n - i]