Pagini recente » Cod sursa (job #2139839) | Cod sursa (job #713629) | Cod sursa (job #2274625) | Cod sursa (job #1538643) | Cod sursa (job #3209459)
#include <iostream>
#include <fstream>
#define nl '\n'
using namespace std;
ifstream fin("dirichlet.in");
ofstream fout("dirichlet.out");
const int MOD = 9999991;
int n, factN, fact;
int lgpow(int b, int pow)
{
int p = 1;
while (pow)
{
if (pow&1)
p = (1LL*p*b)%MOD;
b = (1LL*b*b)%MOD;
pow>>=1;
}
return p;
}
int invmod(int x)
{
return lgpow(x, MOD-2);
}
int main()
{
fin >> n;
fact = 1;
for (int i = 1; i <= 2*n; i++)
{
fact = (1LL*fact*i)%MOD;
if (i == n)
factN = fact;
}
factN = (1LL*factN*factN)%MOD;
int ans = (1LL*fact*invmod(factN))%MOD;
ans = (1LL*ans*invmod(n+1))%MOD;
fout << ans;
return 0;
}