#include <bits/stdc++.h>
#define endl "\n" // don't use when you cover interactive problem
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
ll m;
ll rm[4001];
ll c[4001][2001];
ll mod = 100007;
ll give_c(ll n, ll m)
{
m = min(m, n-m);
if(c[n][m] != -1) return c[n][m]; // 정리 DP 캐싱할때 나올 수 없는값으로 비교
else{
ll pre = give_c(n-1, m)%mod + give_c(n-1, m-1)%mod;
return c[n][m] = pre%mod;
}
}
ll give_rm(ll n)
{
if(rm[n] != -1) return rm[n]; // dp값이 0이 될 수 있을때 이렇게 하면 안됨
else {
ll pre = give_rm(n - 1);
pre += give_c(2*n+3, n);
pre %= mod;
pre += give_c(2*n+3, n);
pre %= mod;
return rm[m] = pre;
}
}
ll solve(ll m)
{
ll ans = m*3%mod;
for(ll i = 0; i < m-3; i++){
ll tmp = (give_c(2*i+5, i+2) - give_rm(i) + mod * mod)%mod; // mod 연산에서는 음수나올 수 있음
ans += m*tmp%mod;
}
return ans%mod;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("../input.txt", "r", stdin);
freopen("../output.txt", "w", stdout);
#endif
cin >> m;
fill_n(rm, 4001, -1);
fill_n(c[0], 4001*2001, -1);
rm[0] = 2;
for(int i = 1; i < 4001; i++){
c[i][0] = 1;
c[i][1] = i;
}
cout << solve(m) << endl;
return 0;