// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstring>

#include <vector>

#include <deque>

#include <queue>

#include <array>

#include <set>

#include <map>

#include <cmath>

#include <algorithm>

#include <numeric>

#include <cassert>

#include <utility>

#include <functional>

#include <bitset>



using namespace std;

using lli = long long int;

template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 

{ v = vector<T>(n, x); }

template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }

template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 

{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }

template<class T> void read_n(T a[], size_t n, size_t o = 0)

{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }

template<class T> T gabs(const T& x) { return max(x, -x); }

#define abs gabs



const lli mod = 1e9+7;

lli n, memo[101][4][4][4];



lli toi(char c) {

  if (c == 'A') return 0;

  if (c == 'C') return 1;

  if (c == 'G') return 2;

  return 3;

}



lli rec(lli i, char c, char d, char e) {

  auto& ref = memo[i][toi(c)][toi(d)][toi(e)];

  if (i == n) return 1;

  if (ref > 0) return ref;

  bool C = true, G = true;

  if ((c == 'A' || d == 'A' || e == 'A') 

      && (d == 'G' || e == 'G')) C = false;

  if (d == 'A' && e == 'C') G = false;

  lli res = 0;

  res += rec(i+1, d, e, 'A');

  if (C) res += rec(i+1, d, e, 'C');

  if (G) res += rec(i+1, d, e, 'G');

  res += rec(i+1, d, e, 'T');

  return ref = res % mod;

}



int main() {

  cin >> n;

  lli ans = rec(0, 'T', 'T', 'T');

  for (lli i=3; i<=100; ++i) {

    fill(&memo[0][0][0][0], &memo[100][3][3][3]+1, 0);

    n = i;

    // cout << i << '\t' << rec(0, 'T', 'T', 'T') << endl;

  }

  cout << ans << endl;

  return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.500586578734858x):
#include <iostream>

#include <cstdio>

#include <cstring>

#include <vector>

#include <deque>

#include <queue>

#include <array>

#include <set>

#include <map>

#include <cmath>

#include <algorithm>

#include <numeric>

#include <cassert>

#include <utility>

#include <functional>

#include <bitset>



using namespace std;

using lli = long long int;

template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 

{ v = vector<T>(n, x); }

template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }

template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 

{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }

template<class T> void read_n(T a[], size_t n, size_t o = 0)

{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }

template<class T> T gabs(const T& x) { return max(x, -x); }

#define abs gabs



const lli mod = 1e9+7;

lli n, memo[101][4][4][4];



lli toi(char c) {

  if (c == 'A') return 0;

  if (c == 'C') return 1;

  if (c == 'G') return 2;

  return 3;

}



lli rec(lli i, char c, char d, char e) {

  auto& ref = memo[i][toi(c)][toi(d)][toi(e)];

  if (i == n) return 1;

  if (ref > 0) return ref;

  bool C = true, G = true;

  if ((c == 'A' || d == 'A' || e == 'A') 

      && (d == 'G' || e == 'G')) C = false;

  if (d == 'A' && e == 'C') G = false;

  lli res = 0;

  res += rec(i+1, d, e, 'A');

  if (C) res += rec(i+1, d, e, 'C');

  if (G) res += rec(i+1, d, e, 'G');

  res += rec(i+1, d, e, 'T');

  return ref = res % mod;

}



int main() {

  cin >> n;

  lli ans = rec(0, 'T', 'T', 'T');

  cout << ans << endl;

  return 0;

}