#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
#define MAX 1111
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const double Pi = 3.1415926;
const double gap = 0.0000001;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> Pair;
int n,m,k;
int x,y;
ull ans;
ull C[MAX],B[MAX],A[MAX];
void get_C(int pos)
{
C[0] = 1;
C[1] = C[2] = 4;
int a = 1;
int b = 2;
for(int i=3; i<=pos; ++i)
{
C[i] = (C[a] + C[b])%MOD;
a = b;
b = i;
}
return;
}
void get_B(int pos)
{
B[1] = 2;
int i = 2;
for(i=2; i<=pos; ++i)
B[i] = (B[i-1] + C[i-2])%MOD;
return;
}
void get_A(int pos)
{
A[1] = 1;
A[2] = 3;
A[3] = 6;
int i = 0;
for(i=4; i<=pos; ++i)
A[i] = (A[i-1] + B[i-1])%MOD;
return;
}
ull quick_pow(ull base, ull exp)
{
if(exp == 0)
return 1;
ull temp = 1;
if(exp%2)
temp = base;
return (temp*quick_pow((base*base)%MOD, exp/2))%MOD;
}
int main(void)
{
cin >> n;
get_C(1000);
get_B(1000);
get_A(1000);
ull ans = (A[n] * quick_pow(2, n+1)%MOD)%MOD;
cout << ans << endl;
return 0;
}
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交