-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path53C
40 lines (37 loc) · 833 Bytes
/
53C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//I_love_StarnyC
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define fix cout<<std::fixed;
#define mk make_pair
#define mod 1000000007
#define time cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll binexp(ll x,ll y)
{
ll res=1;
while(y>0)
{ if(y&1)
res=(res*x)%mod;
x=((x%mod)*(x%mod)%mod);
y=y>>1;
}
return res%mod;
}
int main()
{
ll n;cin>>n;
ll dp[2*n+1];
dp[0]=1;
for(int i=1;i<=2*n-1;i++)
{
dp[i]=(i*dp[i-1])%mod;
}
ll ans=((binexp(dp[n],mod-2)*binexp(dp[n-1],mod-2))%mod)%mod;
ans=(ans*2*dp[2*n-1])%mod;
cout<<(ans+mod-n)%mod;
}