简单数学题
推公式
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
#define mod 1000000007
ll qpow(ll a,ll b){
ll ans=1;
a%=mod;
while(b){
if(b&1){
ans=ans*a%mod;
}
b/=2;
a=a*a%mod;
}
return ans;
}
int main()
{
ll n;
while(~scanf("%lld",&n)){
ll x=(n-1)%mod;
ll ans=qpow(2,n);
ans=((ans*x)%mod+1)%mod;
cout<<ans<<endl;
}
return 0;
}