// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <algorithm>

#include <vector>

#include <cmath>

#include <queue>

#include <map>

#include <unordered_map>

#include <set>

#include <functional>

#include <iomanip>

#include <bitset>

#include <cassert>

using namespace std;



typedef long long ll;



ll mod = 1e9 + 7;

map<string, ll> dp[103];





int main() {

	int n; cin >> n;

	char a[] = { 'A', 'G', 'C', 'T' };

	vector<string> key;

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

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

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

				key.push_back({ a[i], a[j], a[k] });

			}

		}

	}

	

	dp[0]["TTT"] = 1;

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

		for (string k : key) {

			dp[i][{k[1], k[2], 'A'}] += dp[i - 1][k];

			dp[i][{k[1], k[2], 'A'}] %= mod;

		}

		for (string k : key) {

			if (k[1] == 'A' && k[2] == 'G') continue;

			if (k[0] == 'A' && k[1] == 'G') continue;

			if (k[0] == 'A' && k[2] == 'G') continue;

			if (k[1] == 'G' && k[2] == 'A') continue;

			dp[i][{k[1], k[2], 'C'}] += dp[i - 1][k];

			dp[i][{k[1], k[2], 'C'}] %= mod;

		}

		for (string k : key) {

			if (k[1] == 'A' && k[2] == 'C') continue;

			dp[i][{k[1], k[2], 'G'}] += dp[i - 1][k];

			dp[i][{k[1], k[2], 'G'}] %= mod;

		}

		for (string k : key) {

			dp[i][{k[1], k[2], 'T'}] += dp[i - 1][k];

			dp[i][{k[1], k[2], 'T'}] %= mod;

		}

	}

	ll ans = 0;

	for (auto k : key) ans += dp[n][k], ans %= mod;

	cout << ans << endl;

	return 0;

}


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

#include <string>

#include <algorithm>

#include <vector>

#include <cmath>

#include <queue>

#include <map>

#include <unordered_map>

#include <set>

#include <functional>

#include <bitset>

#include <numeric>

#include <complex>

#include <iomanip>

#include <cassert>

#include <random>



#line 1 "lib/modint.hpp"







#include <iostream>



// Modint

struct Mint {

    static const long long mod = (long long)1e9 + 7;

    long long val;



    Mint() { val = 0; }

    Mint(long long a) { val = a; verify_value(); }



    void verify_value() {

        if (val >= mod) val %= mod;

        if (val < 0) val %= mod, val += mod;

    }



    Mint pow(long long p) const {

        Mint cur = Mint(val), ret = 1;

        while (p > 0) {

            if (p & 1) ret *= cur;

            cur *= cur;

            p >>= 1LL;

        }

        return ret;

    }

    Mint inv() const {

        if (val == 0)

            std::cerr << "WARNING: inv() is called with 0." << std::endl;

        return pow(mod - 2);

    }



    Mint operator+() const { return *this; }

    Mint operator-() const { return Mint(mod - val); }



    Mint operator+=(const Mint &a) {

        val += a.val;

        if (val >= mod) val -= mod;

        return Mint(val);

    }

    Mint operator*=(const Mint &a) {

        val *= a.val;

        if (val >= mod) val %= mod;

        return Mint(val);

    }

    Mint operator-=(const Mint &a) { return *this += -a; }

    Mint operator/=(const Mint &a) { return *this *= a.inv(); }



    Mint operator++() { return *this += Mint(1); }

    Mint operator--() { return *this -= Mint(1); }

    Mint operator++(int) {

        Mint ret = *this;

        ++(*this);

        return ret;

    }

    Mint operator--(int) {

        Mint ret = *this;

        --(*this);

        return ret;

    }



    operator long long() const { return val; }

};



Mint operator+(const Mint &a, const Mint &b) {

    long long ret = a.val + b.val;

    if (ret >= Mint::mod) ret -= Mint::mod;

    return Mint(ret);

}

Mint operator*(const Mint &a, const Mint &b) {

    long long ret = a.val * b.val;

    if (ret >= Mint::mod) ret %= Mint::mod;

    return Mint(ret);

}

Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }

Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }



std::ostream &operator<<(std::ostream &out, const Mint &a) { return out << a.val; }

std::istream &operator>>(std::istream &in, Mint &a) {

    in >> a.val;

    a.verify_value();

    return in;

}



Mint pow(Mint a, long long b) {

    return a.pow(b);

}





int main() {

    int n; std::cin >> n;

    std::vector<std::map<std::string, Mint>> dp(n + 2);

    dp[0][""] = 1;

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

        for (const auto &p : dp[i]) {

            const std::string &s = p.first;

            const Mint &m = p.second;

            if (s.size() <= 1) {

                for (char c : "ATGC") {

                    if (c == 0) continue;

                    dp[i + 1][s + c] += dp[i][s];

                }

            }

            else {

                std::string suf;

                suf += *(s.end() - 2);

                suf += s.back();

                if (suf != "AG" && suf != "GA" && s != "ATG" && s != "AGT"

                    && s != "AAG" && s != "AGG" && s != "AGA")

                    dp[i + 1][suf + "C"] += dp[i][s];

                if (suf != "AC") dp[i + 1][suf + "G"] += dp[i][s];

                for (char c : "AT") {

                    if (c == 0) continue;

                    dp[i + 1][suf + c] += dp[i][s];

                }

            }

        }

    }

    Mint ans = 0;

    for (auto &p : dp[n]) ans += p.second;

    std::cout << ans << std::endl;

    return 0;

}


// Fastest known solution for this problem: