//不能用cmath中的pow,会超过double的最大范围 #include <iostream> #include <cmath> using namespace std; const int mod = 1e9+7; int main() { int N; cin>>N; if(N<=2){ switch (N) { case 1:cout<<0;return 0; case 2:cout<<1;return 0; } } long long ans = 1,yezi = 2; for(int i = 2;i<N;i++){ ans = (ans+3*yezi)%mod; yezi = (yezi*2)%mod; //cout<<ans%mod<<endl; } cout<<ans%mod; return 0; }