Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int p=1000000007;
- unsigned long long Fact(int n)
- {
- unsigned long long a1=1,a2=1;
- int z;
- if(n%2) z=(n+1)/2; else z=(n)/2;
- for(int i=1;i<=z;++i)
- {
- if(2*i<=n) a1=a1*2*i%p;
- a2=a2*(2*i-1)%p;
- }
- return a1*a2%p;
- }
- int main()
- {
- //ios_base::sync_with_stdio(false);
- //cin.tie(0);
- int n;
- cin>>n;
- ++n;
- cout<<(n*Fact(n)%p-1)%p;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement