Pagini recente » Cod sursa (job #134051) | Cod sursa (job #348718) | Profil lunguroxana | Cod sursa (job #164961) | Cod sursa (job #2728740)
#include "bits/stdc++.h"
#include <cassert>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
using pd = pair<double, double>;
using pld = pair<ld, ld>;
const int MAX_N = 1e6, M = 1e7 - 9;
ll mod_inverse[MAX_N + 1];
int main()
{
freopen("dirichlet.in", "r", stdin);
freopen("dirichlet.out", "w", stdout);
int N;
scanf("%d", &N);
ll num{1}, denom{1};
for (int K = 2; K <= N; ++K)
{
num = (num * (N + K)) % M;
denom = (denom * K) % M;
}
ll res_denom{1};
int exp = M - 2;
while (exp)
{
if (exp & 1)
{
res_denom = (res_denom * denom) % M;
}
denom = (denom * denom) % M;
exp >>= 1;
}
printf("%d", (num * res_denom) % M);
}