module AOJ_Volume0096;

import std.stdio,std.string,std.conv;

int main()
{
	int k[4001];
	foreach(i;0..4001)
	{
		k[i] = i+1;
	}

	string s;
	while((s = readln.chomp).length != 0)
	{
		int n = s.to!int;
		int count = 0;
		foreach(a;0..1001)
		{
			foreach(b;0..1001)
			{
				if(a + b <= n)
				{
					int m = n - a - b;
					if(m <= 1000)
					{
						count += k[m];
					}
					else if(m <= 2000)
					{
						count += k[2000 - m];
					}
				}
			}
		}

		count.writeln;
	}
	return 0;
}