#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll dp[300][10][10][10];

//-------------------------↓↓↓↓↓↓------------------------

bool check(ll l,ll k,ll j){
    if(l==0&&k==2&&j==1)return false;
    else if(l==0&&k==1&&j==2)return false;
    else if(l==2&&k==0&&j==1)return false;
    else return true;
}

bool check2(ll z,ll l,ll k,ll j){
    if(z==0&&l==2&&k==1)return false;
    else if(z==0&&l==1&&k==2)return false;
    else if(z==2&&l==0&&k==1)return false;
    else if(l==0&&k==2&&j==1)return false;
    else if(l==0&&k==1&&j==2)return false;
    else if(l==2&&k==0&&j==1)return false;
    else if(z==0&&k==2&&j==1)return false;
    else if(z==0&&l==2&&j==1)return false;
    else return true;
}

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);

    cin>>n;
  
    rep(i,4){
        rep(j,4){
            rep(k,4){
                if(!check(k,j,i))continue;
                dp[3][i][j][k]=1;
            }
        }
    }

    rrep(i,4,n+1){
        rep(j,4){
            rep(k,4){
                rep(l,4){
                    cnt=0;
                    rep(z,4){
                        if(!check2(z,l,k,j)){
                            //cout<<z<<" "<<l<<" "<<k<<" "<<j<<"\n";
                            /*
                            if(z==0)cout<<'A';
                            else if(z==1)cout<<'C';
                            else if(z==2)cout<<'G';
                            else cout<<'T';

                            if(l==0)cout<<'A';
                            else if(l==1)cout<<'C';
                            else if(l==2)cout<<'G';
                            else cout<<'T';

                            if(k==0)cout<<'A';
                            else if(k==1)cout<<'C';
                            else if(k==2)cout<<'G';
                            else cout<<'T';

                            if(j==0)cout<<'A';
                            else if(j==1)cout<<'C';
                            else if(j==2)cout<<'G';
                            else cout<<'T';
                            cout<<"\n";
                            */
                           tmp+=dp[i-1][k][l][z];
                            continue;
                        }
                        (cnt+=dp[i-1][k][l][z])%=MOD;
                    }
                    (dp[i][j][k][l]+=cnt)%=MOD;
                }
            }
        }
    }

    rep(i,4){
        rep(j,4){
            rep(k,4){
                (ans+=dp[n][i][j][k])%=MOD;
            }
        }
    }
    Cout(ans);
   // Cout(tmp);
    return 0;
}


Measured memory_bytes: 896