#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define INF 100000000
typedef long long ll;

int main(void) {
    int n;
    while (cin >> n) {
        ll ans = 0;
        for (int a = 0; a <= 1000; a++) {
            for (int b = 0; b <= 1000; b++) {
                if (a + b > n || n - (a+b) > 2000) continue;
                ans += min((n-a-b), 2000-(n-a-b)) + 1;
            }
        }
        cout << ans << endl;
    }
    return 0;
}