using System;

public class Hello
{
    public static void Main()
    {
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var ret = 0;
            var n = int.Parse(line.Trim());
            var imax = Math.Min(2000, n);
            for (int i = 0; i <= imax; i++)
                ret += get2000(i) * get2000(n - i);
            Console.WriteLine(ret);
        }
    }
    public static int get2000(int n)
    {
        return n >= 2001 ? 4001 - n : n + 1;
    }
}
