// vim: foldmethod=marker
// templates {{{
#include <bits/stdc++.h>
using namespace std;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

inline int input(){ int i; scanf("%d%*c", &i); return i; }
inline double dinput(){ double d; scanf("%lf%*c", &d); return d; }
inline void output(int i, char c = '\n'){ printf("%d%c", i, c); }
inline void output(ll l, char c = '\n'){ printf("%lld%c", l, c); }

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)

#define ALL(o) o.begin(), o.end()
//}}}

const int INF = 1000000000;
const int MOD = 1000000000 + 0;
#define EPS (1e-14)

ll comb[4096];

int main()
{
    int n;

    REP(i, 1001){
        REP(j, 1001){
            comb[i + j]++;
        }
    }
    while (~scanf("%d", &n)){
        ll cnt = 0;

        REP(i, n / 2 + 1){
            if (n - i > 2000) continue;
            ll t = comb[i] * comb[n - i];
            if (n % 2 || i != n / 2) t *= 2;
            cnt += t;
        }
        output(cnt);
    }

    return 0;
}