// Slower C++ solution:
#include <bits/stdc++.h>



#define int long long

#define uint unsigned int

#define pii pair<int, int>



#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define FORR(i,a,b) for(int i=(a);i>=(b);--i)

#define REP(i,n) FOR(i,0,n)

#define REPR(i,n) FORR(i,n,0)

#define ALL(c) ((c).begin()), ((c).end())



#define PB(a) push_back(a)

#define EMPB(...) emplace_back(__VA_ARGS__)

#define EMP(...) emplace(__VA_ARGS__)

#define MP(a,b) make_pair(a,b)

#define MT(...) make_tuple(__VA_ARGS__)



#define ZERO(a) memset(a,0,sizeof(a))

#define MINUS(a) memset(a,0xff,sizeof(a))

#define MINF(a) memset(a,0x3f,sizeof(a))



#define PW(n) (1LL << (n))



using namespace std;



template <class T> inline bool CHMIN(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template <class T> inline bool CHMAX(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template <class T> inline void SORT(T &a) { sort(a.begin(), a.end()); }

template <class T> inline void REV(T &a) { reverse(a.begin(), a.end()); }

template <class T> inline void UNI(T &a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }



template <class S, class T> ostream& operator << (ostream& os, const pair<S, T> v) {

  os << "(" << v.first << ", " << v.second << ")"; return os;

}



const int MOD = 1000000007;

const int INF = 0x3f3f3f3f3f3f3f3f;

const double EPS = 1e-10;



/* ---------------------------------------------------------------------------------------------------- */



int N;

int dp[110][5][5][5][5];



signed main() {

  cin.tie(0);

  ios_base::sync_with_stdio(false);

  cout << fixed << setprecision(10);

  

  cin >> N;

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

  REP(i, N) REP(p, 5) REP(q, 5) REP(r, 5) REP(s, 5) {

    if (q == 1 && r == 3 && s == 2) continue;

    if (p == 1 && r == 3 && s == 2) continue;

    if (p == 1 && q == 3 && s == 2) continue;

    if (p == 1 && q == 3 && r == 2) continue;

    if (q == 3 && r == 1 && s == 2) continue;

    if (q == 1 && r == 2 && s == 3) continue;

    if (p == 3 && q == 1 && r == 2) continue;

    if (p == 1 && q == 2 && r == 3) continue;

    FOR(j, 1, 5) (dp[i+1][q][r][s][j] += dp[i][p][q][r][s]) %= MOD;

  }

  int ans = 0;

  REP(p, 5) REP(q, 5) REP(r, 5) REP(s, 5) {

    if (q == 1 && r == 3 && s == 2) continue;

    if (p == 1 && r == 3 && s == 2) continue;

    if (p == 1 && q == 3 && s == 2) continue;

    if (p == 1 && q == 3 && r == 2) continue;

    if (q == 3 && r == 1 && s == 2) continue;

    if (q == 1 && r == 2 && s == 3) continue;

    if (p == 3 && q == 1 && r == 2) continue;

    if (p == 1 && q == 2 && r == 3) continue;

    (ans += dp[N][p][q][r][s]) %= MOD;

  }

  cout << ans << endl;



  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.6114759614454706x):
#include <bits/stdc++.h>

#define int long long

#define endl '\n'

#define FOR(i, a, n) for (int i = (a); i < (n); ++i)

#define REP(i, n) FOR(i, 0, n)

using namespace std;



const int MOD = 1000000007;

const int A = 1;

const int C = 2;

const int G = 3;

const int T = 4;

int N;

int dp[110][5][5][5];



bool ok(int a, int b, int c, int d) {

    // AGC

    if (a == A && b == G && c == C) return false;

    if (b == A && c == G && d == C) return false;



    // ACG

    if (a == A && b == C && c == G) return false;

    if (b == A && c == C && d == G) return false;



    // GAC

    if (a == G && b == A && c == C) return false;

    if (b == G && c == A && d == C) return false;



    // A*GC

    if (a == A && c == G && d == C) return false;



    // AG*C

    if (a == A && b == G && d == C) return false;



    return true;

}



void _main() {

    cin >> N;

    FOR (i, 1, 5) FOR (j, 1, 5) FOR (k, 1, 5) {

        if (ok(i, j, k, 0)) {

            dp[3][i][j][k] = 1;

        }

    }

    FOR (i, 3, N) FOR (j, 1, 5) FOR (k, 1, 5) FOR (l, 1, 5) {

        FOR (m, 1, 5) {

            if (ok(j, k, l, m)) {

                (dp[i + 1][k][l][m] += dp[i][j][k][l]) %= MOD;

            }

        }

    }

    int ans = 0;

    FOR (i, 1, 5) FOR (j, 1, 5) FOR (k, 1, 5) {

        (ans += dp[N][i][j][k]) %= MOD;

    }

    cout << ans << endl;

}



signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout << fixed << setprecision(10);

    _main();

    return 0;

}