#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i,n) FOR(i,0,n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main(void){
	ll dp[4][2001];
	fill_n(*dp, 4*2001, 0);
	//????????????
	rep(i, 1001)dp[0][i] = 1;

	for(int i = 1; i <= 3; i++)
		for(int j = 2000; j >= 0; j--)
			for(int k = 0; k <= 1000; k++){
				if(j-k < 0)break;
				dp[i][j] += dp[i - 1][j - k];
			}

	int n;
	while(cin >> n){
		if(n > 2000)n -= 4000;
		FIN(dp[3][abs(n)]);
	}

	return 0;
}