#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
 
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
/*vector<map<string,mint>> memo(101);
/*ll dfs(ll i, string st){
    if(i == N) return 1LL;

}*/

int main(){
    ll N;
    cin >> N;
    //dfs(0LL,"TTT")
    vector<map<string,mint>> dp(101);
    //vector<vector<mint>> dp(101, vector<mint>(256));
    string sam = "ACGT";
    dp[0]["TTT"] = 1;
    rep(i,N){
        rep(a,4)rep(b,4)rep(c,4){
            string str = {sam[a],sam[b],sam[c]};
            string last2 = str.substr(1,2);
            string f2 = str.substr(0,2);
            vector<char> v;
            if(last2 == "AG"){
                v.push_back('C');
            }else if(last2 == "GA"){
                v.push_back('C');
            }else if(last2 == "AC"){
                v.push_back('G');
            }
            if(f2 == "AG"){
                v.push_back('C');
            }
            if(str[0] == 'A' && str[2] == 'G'){
                v.push_back('C');
            }
            rep(d,4){
                if(!v.empty() && v[0] == sam[d]) continue;
                dp[i+1][str.substr(1,2)+sam[d]] += dp[i][str];
            }
        }
    }
    mint ans = 0;
    rep(a,4)rep(b,4)rep(c,4){
        string str = {sam[a],sam[b],sam[c]};
        ans += dp[N][str];
    }
    cout << ans << endl;
    /*
        rep(a,4){
            rep(b,4){
                rep(c,4){
                    rep(d,4){
                        string str = {sam[a],sam[b],sam[c],sam[d]};
                        dp[3][str] = 1;
                    }
                }
            }
        }
    }
    ll ans = 1;
    rep(i,N){
        ans *= 4;
    }
    REP(i,3,100){
        rep(a,4){
            rep(b,4){
                rep(c,4){
                    rep(d,4){
                        string str = {sam[a],sam[b],sam[c],sam[d]};
                        dp[i+1][str.substr(1,3)+"A"] += dp[i][str];
                        dp[i+1][str.substr(1,3)+"C"] += dp[i][str];
                        dp[i+1][str.substr(1,3)+"G"] += dp[i][str];
                        dp[i+1][str.substr(1,3)+"T"] += dp[i][str];
                    }
                }
            }
        }
    }
    rep(i,)
    cout << ans << endl;*/
    /*
    REP(i,3,101){
        dp[i+1]["AAGC"] = dp[i]["AAAG"] + dp[i]["CAAG"] + dp[i]["GAAG"] + dp[i]["TAAG"]; 
        dp[i+1]["CAGC"] = dp[i]["ACAG"] + dp[i]["CCAG"] + dp[i]["GCAG"] + dp[i]["TCAG"]; 
        dp[i+1]["GAGC"] = dp[i]["AGAG"] + dp[i]["CGAG"] + dp[i]["GGAG"] + dp[i]["TGAG"]; 
        dp[i+1]["TAGC"] = dp[i]["ATAG"] + dp[i]["CTAG"] + dp[i]["GTAG"] + dp[i]["TTAG"]; 

        dp[i+1]["AGAC"] = dp[i]["AAGA"] + dp[i]["CAGA"] + dp[i]["GAGA"] + dp[i]["TAGA"];
        dp[i+1]["CGAC"] = dp[i]["ACGA"] + dp[i]["CCGA"] + dp[i]["GCGA"] + dp[i]["TCGA"];
        dp[i+1]["GGAC"] = dp[i]["AGGA"] + dp[i]["CGGA"] + dp[i]["GGGA"] + dp[i]["TGGA"];
        dp[i+1]["TGAC"] = dp[i]["ATGA"] + dp[i]["CTGA"] + dp[i]["GTGA"] + dp[i]["TTGA"];

        dp[i+1]["AACG"] = dp[i]["AAAC"] + dp[i]["CAAC"] + dp[i]["GAAC"] + dp[i]["TAAC"];
        dp[i+1]["CACG"] = dp[i]["ACAC"] + dp[i]["CCAC"] + dp[i]["GCAC"] + dp[i]["TCAC"];
        dp[i+1]["GACG"] = dp[i]["AGAC"] + dp[i]["CGAC"] + dp[i]["GGAC"] + dp[i]["TGAC"];
        dp[i+1]["TACG"] = dp[i]["ATAC"] + dp[i]["CTAC"] + dp[i]["GTAC"] + dp[i]["TTAC"];


    }
    cout << ans << endl;*/
}

Measured memory_bytes: 4100