Pagini recente » Cod sursa (job #428265) | Cod sursa (job #1530221) | Cod sursa (job #1957248) | Cod sursa (job #1963011) | Cod sursa (job #1948750)
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
const long long MOD = 9999991 ;
int CalcProd ( int x , int y ){
static int i ;
static long long prod ;
prod = 1 ;
for ( i = x ; i <= y ; i ++ ){
prod = prod * 1LL * i ;
prod %= MOD;
}
return prod ;
}
int CalcFastExponent ( int x , int power ){
long long temp ;
if ( power == 1 ){
return x % MOD ;
}
temp = CalcFastExponent( x , power / 2 );
temp = temp * temp % MOD ;
if ( power % 2 ){
return (temp * x)%MOD ;
}
return temp ;
}
int main(){
long long sum ;
int n ;
freopen("dirichlet.in","r",stdin);
freopen("dirichlet.out","w",stdout);
scanf("%d",&n);
sum = CalcProd( n + 2 , 2 * n );
sum = ( sum * CalcFastExponent ( CalcProd( 1 , n ) , MOD - 2 ) ) %MOD ;
printf("%d", sum );
// printf("%d", CalcFastExponent( MOD , MOD-1 ) );
return 0;
}