#include<bits/stdc++.h>
using namespace std;

#define double long double
#define int long long
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
} 
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

inline int Pow(int a, int k) {
  int s = 1; 
  for(; k; k >>= 1) {
    k & 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}

const int N = 1e6 + 7;
string ACGT = "ACGT";

void input() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);
}

void preprocess() {
}

void debug() {
  //  44gg
  if (true) {
    
  }
}

/*
void recur(int n) {
  if (n == 0) {cout << endl; return;}
  for (char ch : ACGT) {recur(n - 1); cout << ch;}
}
*/

vec<string> v2, v3;

map<string, int> m2, m3;

void test(int n, vec<string> &v, map<string, int> &m) {
  queue<string> q;
  q.push("");
  FOR(i, 0, n) {
    queue<string> temp;
    while (!q.empty()) {
      string s = q.front(); q.pop();
      for (char &ch : ACGT) {temp.push(s + ch);}
    }
    swap(q, temp);
  }
  while (!q.empty()) {
    //cout << q.front() << endl; 
    m[q.front()] = v.size();
    v.push_back(q.front());
    q.pop();
  
  }
}

int dp[123][345];

set<string> bad;

void solve() {
  preprocess();
  // 50gg
  //recur(4);
  
  bad.insert("AGC");
  bad.insert("ACG");
  bad.insert("GAC");
  bad.insert("ATGC");
  bad.insert("AGTC");
  bad.insert("AGGC");


  //test(4);
  test(2, v2, m2);
  test(3, v3, m3);

  int n;
  cin >> n;
  int k3 = v3.size();
  //cerr << "k3 = " << k3 << endl;
  // Base case: If not bad then 1
  FOR(j, 0, k3) {
    dp[2][j] = (bad.count(v3[j]) ? 0 : 1);
  }
  int k2 = v2.size();
  //cerr << "k2 = " << k2 << endl;
  FOR(i, 3, n) {
    FOR(j, 0, k2) {
      string s2 = v2[j];
      FOR(x, 0, 4) {
        char ch = ACGT[x];
        string s3 = s2 + ch;
        if (bad.count(s3)) {continue;}
        int id = m3[s3];
        //int id = j * 4 + x;
        //cerr << "id = " << id << endl;
        for (char &ch1 : ACGT) {
          string s4 = ch1 + s3;
          if (bad.count(s4)) {continue;}
          //cerr << "before: " << s4;
          s4 = s4.erase(s4.size() - 1, 1);
          //cerr << "; after: " << s4 << endl;
          int id2 = m3[s4];
          //int id2 = x * 16 + j;
          //cerr << "id2 = " << id2 << endl;
          dp[i][id] = (dp[i][id] + dp[i - 1][id2]) % MOD; 
        }
      }
    }
  }
  
  int res = 0;
  FOR(j, 0, k3) {
    res = (res + dp[n - 1][j]) % MOD;
  }
  cout << res << endl;
  //debug();
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

void output() {

}

#undef int
int main() {
#define int long long
	ios_base::sync_with_stdio(false);
	cin.tie();
  //auto beginProgram = chrono::steady_clock::now();

  //int t; cin >> t;
  //while (t--) 
  {
    input();
    solve();
    output();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


Measured memory_bytes: 512