#include <bits/stdc++.h>
using namespace std;
static const double PI = 6 * asin(0.5);
static const int INF = 1 << 24;
int main() {
  long long a[4][4010] = {0};
  long long b[4][4010] = {0};
  int n = 4005;
  b[0][0] = 1;
  for (int(i) = (0); (i) < ((2001)); ++(i)) {
    if (i > 1000)
      a[0][i] = 1001 - (i - 1000);
    else
      a[0][i] = i + 1;
    if (i) b[0][i] = b[0][i - 1] + a[0][i];
  }
  n = 3001;
  a[1][0] = 1;
  b[1][0] = 1;
  for (int(i) = (0); (i) < ((n)); ++(i)) {
    if (i > 2000)
      a[1][i] = a[1][i - 1] - a[0][i - 1001];
    else if (i > 1000)
      a[1][i] = a[1][1000] - b[0][i - 1001];
    else if (i)
      a[1][i] = a[1][i - 1] + i + 1;
    if (i) b[1][i] = b[1][i - 1] + a[1][i];
  }
  a[2][0] = 1;
  n = 4001;
  for (int(i) = (0); (i) < ((n)); ++(i)) {
    if (i > 3000)
      a[2][i] = b[1][3000] - b[1][i - 1000];
    else if (i > 1000)
      a[2][i] = b[1][i] - b[1][i - 1001];
    else if (i)
      a[2][i] = a[2][i - 1] + a[1][i];
  }
  while (cin >> n) {
    cout << a[2][n] << endl;
  }
  return 0;
}
