#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
	int k[4001];
	rep(i,4001)
	{
		k[i] = i+1;
	}


	int n;
	while(cin >> n)
	{
		long long res = 0;
		rep(a,1001)
		{
			rep(b,1001)
			{
				if(a + b <= n)
				{
					int m = n - a -b;
					if(m <= 1000)
					{
						res += k[m];
					}
					else if(m <= 2000)
					{
						res += k[2000-m];
					}
				}
			}
		}

		cout << res << endl;
	}
}