#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int N,MOD=pow(10,9)+7;
map<ll,map<string,ll> > memo;

bool ok(string last4){
    REP(i,4){
        string str=last4;
        if(i>=1){
            swap(str[i],str[i-1]);
        }
        if(str.find("AGC") != -1){
            return false;
        }
    }
    return true;
}

ll dfs(int cur, string last3){
    if(memo[cur][last3] != 0)return memo[cur][last3];
    if(cur == N)return 1;
    ll res=0;
    char agct[4]={'A','G','C','T'};
    REP(i,4){
        if(ok(last3+agct[i])){
            string next=last3.substr(1,2)+agct[i];
            res=res+dfs(cur+1,next)%MOD;
        }
    }
    memo[cur][last3]=res;
    return res;
}

int main(){
    cin >> N;
    dfs(0,"TTT");
    cout << memo[0]["TTT"]%MOD;
    return 0;   
}