#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator - () const noexcept {
return val ? MOD - val : 0;
}
constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
constexpr Fp& operator += (const Fp& r) noexcept {
val += r.val;
if (val >= MOD) val -= MOD;
return *this;
}
constexpr Fp& operator -= (const Fp& r) noexcept {
val -= r.val;
if (val < 0) val += MOD;
return *this;
}
constexpr Fp& operator *= (const Fp& r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp& operator /= (const Fp& r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
val = val * u % MOD;
if (val < 0) val += MOD;
return *this;
}
constexpr bool operator == (const Fp& r) const noexcept {
return this->val == r.val;
}
constexpr bool operator != (const Fp& r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0) return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1) t = t * a;
return t;
}
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

// 愚直計算による二項係数計算
mint com(long long n, long long r) {
mint res = 1;
for (long long i = 0; i < r; ++i) {
res *= (n-i);
res /= (i+1);
}
return res;
}

int main() {
cin.tie(0);
ios::sync_with_stdio(false);

int n; cin >> n;
// dp[x][i][j][j] := 条件を満たす長さxの文字列であって、後ろ3文字がi,j,kであるものの個数
mint dp[n+1][4][4][4];

// 初期条件
rep(i,4) {
    rep(j,4) {
        rep(k,4) {
            dp[3][i][j][k] = 1;
        }
    }
}
dp[3][0][1][2] = 0;
dp[3][0][2][1] = 0;
dp[3][1][0][2] = 0;

for(int x = 3; x < n; ++x) {
    rep(i,4) {
        rep(j,4) {
            rep(k,4) {
                rep(nk,4) {
                    if(j == 0 && k == 1 && nk == 2) continue;
                    if(j == 0 && k == 2 && nk == 1) continue;
                    if(j == 1 && k == 0 && nk == 2) continue;
                    if(i == 0 && j == 1 && k == 1 && nk == 2) continue;
                    if(i == 0 && j == 0 && k == 3 && nk == 2) continue;
                    if(i == 0 && j == 3 && k == 1 && nk == 2) continue;
                    dp[x+1][j][k][nk] += dp[x][i][j][k];
                }
            }
        }
    }
}
mint ans = 0;
rep(i,4) {
    rep(j,4) {
        rep(k,4) {
            ans += dp[n][i][j][k];
        }
    }
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256