katelandisi
hnahongyi
2023-11-11 10:56:33
#include<bits/stdc++.h>
using namespace std;
long long f[200001];
const int MOD = 1000000007;
long long aaa(long long x, long long n) {
if (n == 0) return 1;
long long tmp = aaa(x, n / 2);
tmp = 1LL * tmp * tmp % MOD;
if (n % 2 == 1) return 1LL * tmp * x % MOD;
else return tmp;
}
long long c(long long n, long long m) {
for (int i = 1; i <= n; i++)f[i] = 1LL * f[i - 1] * i % MOD;
return 1LL * f[n] * aaa(f[m], MOD - 2) % MOD * aaa(f[n - m], MOD - 2) % MOD;
}
long long q(long long a, long long b, long long p) {
if (b == 0) return 1;
long long cmp = q(a, b / 2, p);
cmp = (long long)cmp * cmp % p;
if (b % 2 == 0) return cmp;
else return (long long)cmp * a % p;
}
int main() {
long long n;
cin >> n;
f[0] = 1;
cout << c(2 * n, n)*q(n + 1, MOD - 2, MOD) % MOD;
return 0;
}
共 1 条回复