#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define _size(X) (int)((X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const string c[4] = {"A", "T", "G", "C"};

const int MAX_N = 100;
int N;
ll dp[MAX_N][64];
map<string, int> id;

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

  cin >> N;

  rep(i, 4) {
      rep(j, 4) {
          rep(k, 4) {
              string tmp = c[i] + c[j] + c[k];
              id[tmp] = i*16 + j*4 + k;
              bool judge = false;
              if (tmp == "AGC") judge = true;
              swap(tmp[0], tmp[1]);
              if (tmp == "AGC") judge = true;
              swap(tmp[0], tmp[1]);
              swap(tmp[1], tmp[2]);
              if (tmp == "AGC") judge = true;
              swap(tmp[1], tmp[2]);
              if (!judge) dp[2][id[tmp]] = 1;
          }
      }
  }

  dp[2][id["AGC"]] = 0;
  for (int n = 2; n+1 < N; ++n) {
      rep(i, 4) {
          rep(j ,4) {
              rep(k, 4) {
                  rep(l, 4) {
                      string s = c[i] + c[j] + c[k];
                      ll t  = dp[n][id[s]];
                      s += c[l];
                      bool judge = false;
                      if (s.substr(0, 3) == "AGC") judge = true;
                      if (s.substr(1, 3) == "AGC") judge = true;
                      swap(s[0], s[1]);
                      if (s.substr(0, 3) == "AGC") judge = true;
                      if (s.substr(1, 3) == "AGC") judge = true;
                      swap(s[0], s[1]);
                      swap(s[1], s[2]);
                      if (s.substr(0, 3) == "AGC") judge = true;
                      if (s.substr(1, 3) == "AGC") judge = true;
                      swap(s[1], s[2]);
                      swap(s[2], s[3]);
                      if (s.substr(0, 3) == "AGC") judge = true;
                      if (s.substr(1, 3) == "AGC") judge = true;
                      swap(s[2], s[3]);
                      if (!judge) {
                          (dp[n+1][id[s.substr(1, 3)]] += t) %= MOD;
                      }
                  }
              }
          }
      }
  }


  ll ans = 0;
  for (int i = 0; i < 64; ++i) {
      ans = mod(ans+dp[N-1][i], MOD);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256