Pagini recente » Cod sursa (job #1357753) | Cod sursa (job #670403) | Cod sursa (job #1318865) | Cod sursa (job #2445685) | Cod sursa (job #2330450)
#include<bits/stdc++.h>
using namespace std;
const int mod=9999991;
inline void multiply(int &x,int y)
{
long long res=(1LL*x)*(1LL*y);
res%=mod;
x=res;
}
inline int fastexp(int a,int b)
{
int res=1;
while(b)
{
if(b&1)
{
multiply(res,a);
b--;
}
else
{
multiply(a,a);
b>>=1;
}
}
return res;
}
inline int invmod(int x)
{
return fastexp(x,mod-2);
}
int n;
int main()
{
freopen("dirichlet.in","r",stdin);
freopen("dirichlet.out","w",stdout);
scanf("%d",&n);
int sol=1;
for(int i=n+1;i<=2*n;i++)
multiply(sol,i);
for(int i=1;i<=n;i++)
multiply(sol,invmod(i));
multiply(sol,invmod(n+1));
printf("%d\n",sol);
return 0;
}