// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



const int MOD = 1000000007;



int dp[105][64];



const int A = 0;

const int C = 1;

const int G = 2;

const int T = 3;



map<char, int> MP = {{'A', A}, {'C', C}, {'G', G}, {'T', T}, {'.', 0}, {'x', 3}};



vector<string> badPre = {".AC", ".CA", ".AG", "A.C", "AC."};

vector<string> mask =   {".xx", ".xx", ".xx", "x.x", "xx."};

vector<int> badNext =   {    G,     G,     C,     G,     G};



// convert from string representation to dp array index

inline int convert(string s) {

    int r = 0;

    for(char c : s) {

        r = r<<2;

        r |= MP[c];

    }

    return r;

}



// restricts bad secuences

bool ok(int pre, int next) {

    for(int i = 0; i < 5; i++) {

        if((pre & convert(mask[i])) == convert(badPre[i]) && next == badNext[i] ) {

            return false;

        }   

    }



    return true;

}



int nextIndex(int pre, int next) {

    pre = pre & 15;

    pre <<= 2;

    pre |= next;

    return pre;

}



int main() {



    int n;

    cin >> n;



    for(int i = 0; i < 64; i++) {

        dp[3][i] = 1;

    }

    dp[3][convert("ACG")] = 0;

    dp[3][convert("CAG")] = 0;

    dp[3][convert("AGC")] = 0;



    for(int i = 4; i <= n; i++) {

        for(int seq = 0; seq < 64; seq++) {

            for(int letter = 0; letter < 4; letter++) {

                if(ok(seq, letter)) {

                    dp[i][nextIndex(seq, letter)] += dp[i-1][seq];

                    dp[i][nextIndex(seq, letter)] %= MOD;

                }

            }

        }

    }



    int result = 0;



    for(int i = 0; i < 64; i++) {

        result += dp[n][i];

        result %= MOD;

    }



    cout << result << endl;



    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>



using namespace std;

using ll = long long;



const ll MAX { 110 }, A { 1 }, C { 2 }, G { 3 }, T { 4 }, MOD { 1000000007 };



ll st[MAX][2*MAX];



int encode(int a, int b, int c)

{

    return 25 * a + 5 * b + c;

}



void decode(int n, int&a, int &b, int& c)

{

    c = n % 5;

    n /= 5;



    b = n % 5;

    n /= 5;



    a = n;

}





ll dp(int idx, int N, int mask)

{

    if (idx == N)

        return 1;



    if (st[idx][mask] != -1)

        return st[idx][mask];



    int x, y, z;

    decode(mask, x, y, z);



    // A e T sempre podem ser adicionados

    ll ans = (dp(idx + 1, N, encode(y, z, T)) + dp(idx + 1, N, encode(y, z, A))) % MOD;



    // C só pode adicionado se não violar a regra (não pode formar AGC ou GAC ou AxGC)

    if (encode(0, A, G) != encode(0, y, z) and 

        encode(0, G, A) != encode(0, y, z) and

        encode(A, G, 0) != encode(x, y, 0) and

        encode(A, 0, G) != encode(x, 0, z))

            ans = (ans + dp(idx + 1, N, encode(y, z, C))) % MOD;



    // G só pode adicionado se não violar a regra (não pode formar ACG)

    if (encode(0, A, C) != encode(0, y, z))

        ans = (ans + dp(idx + 1, N, encode(y, z, G))) % MOD;



    st[idx][mask] = ans;



    return ans;

}



int solve(int N)

{

    memset(st, -1, sizeof st);



    return dp(0, N, 0);

}



int main()

{

    ios::sync_with_stdio(false);



    int N;

    cin >> N;



    auto ans = solve(N);



    cout << ans << '\n';



    return 0;

}


// Fastest known solution for this problem: