Pagini recente » Cod sursa (job #3214169) | Cod sursa (job #158251) | Cod sursa (job #2060659) | Cod sursa (job #339374) | Cod sursa (job #1794839)
#include <fstream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
ifstream fin("dirichlet.in");
ofstream fout("dirichlet.out");
const int mod = 9999991;
void Euclid(int a, int b, int& x, int& y) {
if (!b) {
x=1, y=0;
return;
}
int xa, ya;
Euclid(b, a%b, xa, ya);
x = ya;
y = xa - (a/b)*ya;
}
int InvMod(int val) {
int x, y;
Euclid(mod, val, x, y);
y %= mod;
if (y < 0) y += mod;
return y;
}
int Factorial(int n) {
int ret = 1;
for (int i = 1; i <= n; ++i)
ret = (1LL*ret*i) % mod;
return ret;
}
int main() {
int n; fin >> n;
int sol = 1;
sol = (1LL * sol * InvMod(n + 1)) % mod;
sol = (1LL * sol * Factorial(2 * n)) % mod;
sol = (1LL * sol * InvMod(Factorial(n))) % mod;
sol = (1LL * sol * InvMod(Factorial(n))) % mod;
fout << sol << '\n';
return 0;
}
//Trust me, I'm the Doctor!