#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<int, int> P;


class modInt{
    ll value;
    static const ll mod = 1000000007;

public:
    modInt(ll x=0): value{x % mod}{}

    inline modInt& operator+=(modInt x){
        value = (value + x.value) % mod;
        return *this;
    }

    inline modInt& operator-=(modInt x){
        value = (value + mod - x.value) % mod;
        return *this;
    }

    inline modInt& operator*=(modInt x){
        value = (value * x.value) % mod;
        return *this;
    }


    inline modInt operator/=(modInt x){
        *this *= x.inv();
        return *this;
    }

    inline modInt pow(modInt x, int n){
        modInt res = modInt(1LL);
        while(n > 0){
            if(n & 1)   res *= x;
            x *= x;
            n >>= 1;
        }
        return res;
    }

    inline modInt inv(){
        modInt res = pow(value, mod-2);
        return res;
    }

    inline ll get(){
        return value;
    }
};

modInt operator+(modInt x, modInt y){
    return x += y;
}

modInt operator-(modInt x, modInt y){
    return x -= y;
}

modInt operator*(modInt x, modInt y){
    return x *= y;
}

modInt operator/(modInt x, modInt y){
    return x /= y;
}

ostream& operator<<(ostream& os, modInt x){
    return os << x.get();
}


class modIntCombinations{
    vector<modInt> factArray;

    void make_fact(ll x){
        for(auto i = factArray.size(); i <= x+1; i++){
            modInt y = factArray[i-1] * i;
            factArray.push_back(y);
        }
    }

public:
    modIntCombinations(){
        factArray.emplace_back(1);
    }

    modInt fact(ll x){
        if(factArray.size() < x+1){
            make_fact(x);
        }
        return factArray[x];
    }

    modInt comb(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k) / fact(n - k);
        }
    }

    modInt perm(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k);
        }
    }
};

bool ok(string s){
    for(int j = 0; j < 2; j++) {
        if (s[j] == 'A' && s[j + 1] == 'G' && s[j + 2] == 'C') {
            return false;
        }
    }
    for(int i = 1; i <= 3; i++){
        string t = s;
        swap(t[i], t[i-1]);
//        cout << t << endl;
        for(int j = 0; j < 2; j++){
            if(t[j] == 'A' && t[j+1] == 'G' && t[j+2] == 'C'){
                return false;
            }
        }
    }
    return true;
}


int main(){
    int N;  cin >> N;
    char x[4] = {'A', 'G', 'C', 'T'};
    map<int, string> mp;
    map<string, int> imp;
    for(int i = 0; i < 64; i++){
        int t = i;
        string s;
        for(int j = 0; j < 3; j++){
            s += x[t % 4];
            t = (t >> 2);
        }
        mp[i] = s;
        imp[s] = i;
    }

    vector<vector<modInt>> dp(N+1, vector<modInt>(64, 0));

    dp[0][63] = 1;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 64; j++){
            for(int k = 0; k < 4; k++){
                string s = mp[j];
                string t = mp[j] + x[k];
                int nextIndex = imp[t.substr(1)];
                if(ok(t)){
                    dp[i+1][nextIndex] += dp[i][j];
                }
            }
        }
    }

    modInt res = 0;
    for(int i = 0; i < 64; i++){
        res += dp[N][i];
    }

    cout << res << endl;


    return 0;
}


Measured memory_bytes: 256