题目:
解题思路:
(图源CSL的队友)
ac代码:
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long quickpow(long long a, long long b) {
if (b < 0) return 0;
long long ret = 1;
a %= mod;
while(b) {
if (b & 1) ret = (ret * a) % mod;
b >>= 1;
a = (a * a) % mod;
}
return ret;
}
long long inv(long long a) {
return quickpow(a, mod - 2);
}
int main() {
//freopen("/Users/zhangkanqi/Desktop/11.txt","r",stdin);
long long n;
scanf("%lld",&n);
long long ans=((n+1)*inv(2*n))%mod;
printf("%lld",ans);
return 0;
}