#include<iostream>
using namespace std;

int memo[5][5001];

int solve(int p, int n){

  if(!p && !n) return 1;
  if(!p || n < 0 || n > p*1000) return 0;
  if(memo[p][n]) return memo[p][n];
  
  int res = 0;
  for(int i=0;i<1001;i++) res += solve(p-1, n-i);

  return memo[p][n] = res;
}

int main(){

  int n;
  for(int i=0;i<4001;i++) solve(4, i);
  while(cin >> n) cout << memo[4][n] << endl;

}
### Prompt

Your task is to create a cpp solution to the following problem:

Enter a positive integer n of 4,000 or less, with a pair of integers a, b, c, d in the range 0-1000.


a + b + c + d = n


Create a program that outputs the number of combinations that satisfy the conditions.



Input

Given multiple datasets. Each dataset is given n on one row. Please process until the end of the input.

The number of datasets does not exceed 50.

Output

For each data set, output the number of combinations of a, b, c, and d on one line.

Example

Input

2
3
35


Output

10
20
8436

### Response

```cpp
#include<iostream>
using namespace std;

int memo[5][5001];

int solve(int p, int n){

  if(!p && !n) return 1;
  if(!p || n < 0 || n > p*1000) return 0;
  if(memo[p][n]) return memo[p][n];
  
  int res = 0;
  for(int i=0;i<1001;i++) res += solve(p-1, n-i);

  return memo[p][n] = res;
}

int main(){

  int n;
  for(int i=0;i<4001;i++) solve(4, i);
  while(cin >> n) cout << memo[4][n] << endl;

}
```