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



using namespace std;

#define all(x) (x).begin(),(x).end()

#define rep(i, n) for (int i = 0; i < (n); i++)

#define chmin(x, y) (x) = min((x), (y))

#define chmax(x, y) (x) = max((x), (y))

#define endl "\n"

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;



template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}

template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}



ll dp[101][5][5][5];



void solve() {



    int N;

    cin >> N;

    const int mod = 1e9 + 7;



    dp[0][4][4][4] = 1;

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

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

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

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

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

                        vector<int> I = {j, k, l, m};

                        if (I[1] == 0 && I[2] == 1 && I[3] == 2) continue;

                        if (I[1] == 0 && I[2] == 2 && I[3] == 1) continue;

                        if (I[1] == 1 && I[2] == 0 && I[3] == 2) continue;

                        

                        if (I[0] == 0 && I[2] == 1 && I[3] == 2) continue;

                        if (I[0] == 0 && I[1] == 1 && I[3] == 2) continue;

                        

                        dp[i + 1][k][l][m] += dp[i][j][k][l];

                        dp[i + 1][k][l][m] %= mod;

                        

                    }

                }

                

            }

        }

    }



    ll ans = 0;

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

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

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

                ans += dp[N][j][k][l];

                ans %= mod;

            }

        }

    }



    cout << ans << endl;

}



int main() {

    #ifdef LOCAL_ENV

    cin.exceptions(ios::failbit);

    #endif

    cin.tie(0);

    ios::sync_with_stdio(false);

    cout.setf(ios::fixed);

    cout.precision(16);

    

    solve();

}

// Optimized solution to the same problem (faster):
#include <iostream>



using namespace std;



int dp[101][4][4][4];



enum {

    A,G,C,T

};



int main() {

    int N;

    cin >> N;



    const int mod = 1e9 + 7;



    // 0: A

    // 1: G

    // 2: C

    // 3: T

    dp[0][3][3][3] = 1;



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

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

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

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

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

                        if (k == A && l == G && m == C) continue;

                        if (k == A && l == C && m == G) continue;

                        if (k == G && l == A && m == C) continue;

                        if (j == A && l == G && m == C) continue;

                        if (j == A && k == G && m == C) continue;

                        dp[i + 1][k][l][m] += dp[i][j][k][l];

                        dp[i + 1][k][l][m] %= mod;

                    }

                }

            }

        }

    }



    int ans = 0;

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

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

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

                ans += dp[N][j][k][l];

                ans %= mod;

            }

        }

    }

    cout << ans << endl;

    return 0;

}


// Fastest known solution for this problem: