Pagini recente » Cod sursa (job #1153963) | Cod sursa (job #1465964) | Cod sursa (job #1377388) | Cod sursa (job #1218174) | Cod sursa (job #2151729)
#include <iostream>
#include <fstream>
#define MOD 9999991
using namespace std;
ifstream f("dirichlet.in");
ofstream g("dirichlet.out");
long long fact[10000005];
long long invers(long long x,long long y)
{
long long sol=1;
while(y)
{
if(y&1)sol=(1LL*sol*x)%MOD;
x=(1LL*x*x)%MOD;
y>>=1;
}
return sol;
}
void factorial()
{
long long i; fact[1]=1; fact[0]=1;
for(i=2;i<=1000000;i++)fact[i]=(1LL*fact[i-1]*i)%MOD;
}
long long comb(long long n,long long k)
{
if(!n||!k)return 1;
return (1LL*fact[n]*invers(1LL*fact[k]*fact[n-k]%MOD,MOD-2))%MOD;
}
int main()
{
long long n;
f>>n;
factorial();
g<<(comb(2*n,n)*invers(n+1,MOD-2))%MOD;
return 0;
}