#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SRTVG(v) sort(v.begin(),v.end(),greater<>())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef map<string,int> si;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}


int atcoder() {
    ll n;
    cin >> n;
    string codon[]={"AAA","AAT","AAG","AAC","ATA","ATT","ATG","ATC","AGA","AGT","AGG","ACA","ACT","ACC","TAA","TAT","TAG","TAC","TTA","TTT","TTG","TTC","TGA","TGT","TGG","TGC","TCA","TCT","TCG","TCC","GAA","GAT","GAG","GTA","GTT","GTG","GTC","GGA","GGT","GGG","GGC","GCA","GCT","GCG","GCC","CAA","CAT","CAG","CAC","CTA","CTT","CTG","CTC","CGA","CGT","CGG","CGC","CCA","CCT","CCG","CCC"};
    vector<map<string,ll>> v(n+1);
    
    REP(i,0,61) v[3][codon[i]]++;
    REP(i,4,n+1){
        v[i]["AAA"] = v[i]["AAT"] = v[i]["AAG"] = v[i]["AAC"] = (v[i-1]["AAA"] + v[i-1]["TAA"] + v[i-1]["GAA"] + v[i-1]["CAA"])%MOD;
        v[i]["AGA"] = v[i]["AGT"] = v[i]["AGG"] = (v[i-1]["AAG"] + v[i-1]["TAG"] + v[i-1]["GAG"] + v[i-1]["CAG"])%MOD;
        v[i]["ATA"] = v[i]["ATT"] = v[i]["ATG"] = v[i]["ATC"] = (v[i-1]["AAT"] + v[i-1]["TAT"] + v[i-1]["GAT"] + v[i-1]["CAT"])%MOD;
        v[i]["ACA"] = v[i]["ACT"] = v[i]["ACC"] = (v[i-1]["AAC"] + v[i-1]["TAC"] + v[i-1]["CAC"])%MOD;
        v[i]["TAA"] = v[i]["TAT"] = v[i]["TAG"] = v[i]["TAC"] = (v[i-1]["ATA"] + v[i-1]["TTA"] + v[i-1]["GTA"] + v[i-1]["CTA"])%MOD;
        v[i]["TTA"] = v[i]["TTT"] = v[i]["TTG"] = v[i]["TTC"] = (v[i-1]["ATT"] + v[i-1]["TTT"] + v[i-1]["GTT"] + v[i-1]["CTT"])%MOD;
        v[i]["TGA"] = v[i]["TGT"] = v[i]["TGG"] = (v[i-1]["ATG"] + v[i-1]["TTG"] + v[i-1]["GTG"] + v[i-1]["CTG"])%MOD;
        v[i]["TCA"] = v[i]["TCT"] = v[i]["TCG"] = v[i]["TCC"] = (v[i-1]["ATC"] + v[i-1]["TTC"] + v[i-1]["GTC"] + v[i-1]["CTC"])%MOD;
        v[i]["CAA"] = v[i]["CAT"] = v[i]["CAG"] = v[i]["CAC"] = (v[i-1]["ACA"] + v[i-1]["TCA"] + v[i-1]["GCA"] + v[i-1]["CCA"])%MOD;
        v[i]["CTA"] = v[i]["CTT"] = v[i]["CTG"] = v[i]["CTC"] = (v[i-1]["ACT"] + v[i-1]["TCT"] + v[i-1]["GCT"] + v[i-1]["CCT"])%MOD;
        v[i]["CGA"] = v[i]["CGT"] = v[i]["CGG"] = v[i]["CGC"] = (v[i-1]["TCG"] + v[i-1]["GCG"] + v[i-1]["CCG"])%MOD;
        v[i]["CCA"] = v[i]["CCT"] = v[i]["CCG"] = v[i]["CCC"] = (v[i-1]["ACC"] + v[i-1]["TCC"] + v[i-1]["GCC"] + v[i-1]["CCC"])%MOD;
        v[i]["GAA"] = v[i]["GAT"] = v[i]["GAG"] = (v[i-1]["AGA"] + v[i-1]["TGA"] + v[i-1]["GGA"] + v[i-1]["CGA"])%MOD;
        v[i]["GTA"] = v[i]["GTT"] = v[i]["GTG"] = (v[i-1]["AGT"] + v[i-1]["TGT"] + v[i-1]["GGT"] + v[i-1]["CGT"])%MOD;
        v[i]["GGA"] = v[i]["GGT"] = v[i]["GGG"] = (v[i-1]["AGG"] + v[i-1]["TGG"] + v[i-1]["GGG"] + v[i-1]["CGG"])%MOD;
        v[i]["GCA"] = v[i]["GCT"] = v[i]["GCG"] = v[i]["GCC"] = (v[i-1]["TGC"] + v[i-1]["GGC"] + v[i-1]["CGC"])%MOD;
        v[i]["TGC"] = (v[i-1]["TTG"] + v[i-1]["GTG"] + v[i-1]["CTG"])%MOD;
        v[i]["GGC"] = (v[i-1]["TGG"] + v[i-1]["GGG"] + v[i-1]["CGG"])%MOD;
        v[i]["GTC"] = (v[i-1]["TGT"] + v[i-1]["GGT"] + v[i-1]["CGT"])%MOD;
        
    }
    ll ans=0;
    for(auto x : v[n]){
        ans = (ans + x.second)%MOD;
    }
    cout << ans << ENT;
    return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}


Measured memory_bytes: 896