#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define N (1000000000+7) //#define N 998244353 #define INF 1e16 typedef long long ll; typedef pair P; typedef pair Q; typedef vector vec; typedef vector mat; const int inf = (int)1e9; mat mul(mat &A,mat &B){ mat C(A.size(),vec(B[0].size())); for(int i=0;i0){ if(n&1)B = mul(B,A); A = mul(A,A); n>>=1; } return B; } ll inv(ll x,ll power) { ll res = 1; ll k = power; ll y = x%N; while (k) { if (k & 1)res = (res*y) % N; y = (y%N*y%N) % N; k /= 2; } return res; } int main(void){ ll Inv = inv(6LL,N-2); ll n; cin>>n; mat A(6,vec(6)); for(int i=0;i<6;i++){ A[0][i] = Inv; } A[1][0]=1LL; A[2][1]=1LL; A[3][2]=1LL; A[4][3]=1LL; A[5][4]=1LL; A = Pow(A,n); cout<