#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int n;
	while (cin >> n) {
		vi ab(2001, 0);
		// a + b となる組み合わせの数
		rep (a, 1001) rep (b, 1001) {
			ab[a + b]++;
		}
		vi cd(2001, 0);
		// c + d となる組み合わせの数
		rep (c, 1001) rep (d, 1001) {
			cd[c + d]++;
		}

		int ans = 0;
		rep (i, 2001) {
			if (0 <= n - i && n - i <= 2000) {
				ans += (ab[i] * cd[n - i]);
			}
		}
		cout << ans << endl;
	}
}
