#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define fish        push_front
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Deque       std::deque
#define PQueue      std::priority_queue
#define Set         std::set
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B, class C> A power ( A x, B n, C mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A> A lcm ( A x, A y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A> inline boolean chmax ( A &a, const A &b ) { return b > a ? a = b, true : false; }
    template<class A> inline boolean chmin ( A &a, const A &b ) { return b < a ? a = b, true : false; }
    inline boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    // 0 -> A, 1 -> C, 2 -> G, 3 -> T
    char test[] = { 'A', 'C', 'G', 'T' };

    int dp[110][4][4][4][4];
    int n;

    int dfs ( int pos, int now, int pre, int ppre, int pppre) {
        if ( ~dp[pos][now][pre][ppre][pppre] ) return dp[pos][now][pre][ppre][pppre];
        if ( test[pppre] == 'A' && test[pre] == 'G' && test[now] == 'C' ) return 0;
        if ( test[pppre] == 'A' && test[ppre] == 'G' && test[now] == 'C' ) return 0;
        if ( test[ppre] == 'A' && test[pre] == 'G' && test[now] == 'C' ) return 0;
        if ( test[ppre] == 'A' && test[pre] == 'C' && test[now] == 'G' ) return 0;
        if ( test[ppre] == 'G' && test[pre] == 'A' && test[now] == 'C' ) return 0;
        if ( pos == n ) {
            return 1;
        }
        int rec = 0;
        for ( int i = 0; i < 4; i++ ) {
            rec += dfs ( pos+1, i, now, pre, ppre );
            rec %= 1000000007;
        }
        return dp[pos][now][pre][ppre][pppre] = rec;
    }


    signed call_of_Cthulhu( signed datum ) {

        read n;
        memset(dp, -1, sizeof(dp));
        echo dfs ( 0, 3, 3, 3, 3 ) fin;


        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 384