#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <tuple>

using namespace std;
typedef long long ll;

struct mint{
    static const long long MOD = 1000000007;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint operator/(mint a) const {
        return mint(v) /= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

using key = tuple<int, int, int>;

int main(){
    ll n;
    cin >> n;

    map<key, mint> m;
    for(int i1 = 0; i1 < 4; ++i1){
        for(int i2 = 0; i2 < 4; ++i2){
            for(int i3 = 0; i3 < 4; ++i3){
                if((i1 == 0 && i2 == 2 && i3 == 1) || // AGC
                   (i1 == 0 && i2 == 1 && i3 == 2) || // ACG
                   (i1 == 2 && i2 == 0 && i3 == 1)){ // GAC
                    continue;
                }
                m[make_tuple(i1, i2, i3)] = 1;
            }
        }
    }

    for(int i = 4; i <= n; ++i){
        map<key, mint> m2;

        for(auto it = m.begin(); it != m.end(); ++it){
            int i1 = get<0>(it->first);
            int i2 = get<1>(it->first);
            int i3 = get<2>(it->first);
            for(int i4 = 0; i4 < 4; ++i4){
                if((i2 == 0 && i3 == 2 && i4 == 1) || // _AGC
                   (i2 == 0 && i3 == 1 && i4 == 2) || // _ACG
                   (i2 == 2 && i3 == 0 && i4 == 1) || // _GAC
                   (i1 == 0 && i2 == 2 && i4 == 1) || // AG_C
                   (i1 == 0 && i3 == 2 && i4 == 1)){  // A_GC
                    continue;
                }
                key tpl = make_tuple(i2, i3, i4);
                if(m2.count(tpl)){
                    m2[tpl] += m[it->first];
                }else{
                    m2[tpl] = m[it->first];
                }
            }
        }

        m = m2;
    }

    mint ans;
    for(auto it = m.begin(); it != m.end(); ++it){
        ans += it->second;
    }
    cout << ans.v << endl;
    return 0;
}


Measured memory_bytes: 256