#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define rep2(i,l,r) for(int (i)=l;(i)<(ll)(r);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(X,Y) ((X)>(Y)?X=(Y),true:false) #define chmax(X,Y) ((X)<(Y)?X=(Y),true:false) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template ostream &operator<<(ostream &os, const vector &v){int n=v.size();rep(i,n)os< > &A, vector >&B){ int n = A.size(), m = B[0].size(), l = B.size(); vector > X(n, vector(m, 0)); rep(k, l) rep(i, n) rep(j, m) X[i][j] += A[i][k]*B[k][j]; rep(i, n) rep(j, m) X[i][j] %= mod; A = X; } int main(){ vector > A(N, vector(N)); rep(i, 4) rep(j, 4) A[i][j] = 1; rep2(j, 4, 12) rep(i, 4){ int t = 0; if(i==0){ if(j<8) t = 1; } else if(i==3){ if(j>=8) t = 1; } else if(i==1){ if (j==6 || j==7) t = 1; } else if(i==2){ if (j==10 || j==11) t = 1; } A[i][j] = t; } rep(j, 4) rep2(i, 4, 12){ int t = 0; if(j==3){ if(i<8) t = 1; } else if(j==0){ if(i>=8) t = 1; } else if(j==2){ if(i==4 || i==5) t = 1; } else if(j==1){ if(i==8 || i==9) t = 1; } A[i][j] = t; } rep2(j, 4, 8) rep2(i, 4, 8){ int t = 0; if(i-1<=j && j<=i+1) t = 1; A[i][j] = t; } rep2(j, 8, 12) rep2(i, 8, 12){ int t = 0; if(i-1<=j && j<=i+1) t = 1; A[i][j] = t; } ll n; cin>>n; vector > X(A); while(n){ if(n&1) mul(X, A); mul(A, A); n >>= 1; } cout<