#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define reprs(i, s, e) for(int i=s-1; i>=s; i--)

const int MOD = 1e9 + 7;

int main(){

    int n; cin >> n;

    if(n == 1){
        cout << 4;
    }
    else if(n == 2){
        cout << 4*4;
    }
    else if(n == 3){
        cout << 61;
    }
    else{
        ll memo[4][4][4];
        ll next[4][4][4];

        rep(i, 4){
            rep(j, 4){
                rep(k, 4){
                    memo[i][j][k] = 1;
                }
            }
        }
        memo[0][2][1] = 0;
        memo[2][0][1] = 0;
        memo[0][1][2] = 0;


        reps(t, 3, n){

            rep(i, 4){
                rep(j, 4){
                    rep(k, 4){
                        next[i][j][k] = 0;
                    }
                }
            }

            rep(i, 4){
                rep(j, 4){
                    rep(k, 4){
                        
                        if(j == 0 && k == 2){
                            next[j][k][0] += memo[i][j][k];
                            next[j][k][2] += memo[i][j][k];
                            next[j][k][3] += memo[i][j][k];
                        }
                        else if(j == 2 && k == 0){
                            next[j][k][0] += memo[i][j][k];
                            next[j][k][2] += memo[i][j][k];
                            next[j][k][3] += memo[i][j][k];
                        }
                        else if(j == 0 && k == 1){
                            next[j][k][0] += memo[i][j][k];
                            next[j][k][1] += memo[i][j][k];
                            next[j][k][3] += memo[i][j][k];
                        }
                        else if(i == 0 && j == 2 && k == 2){
                            next[j][k][0] += memo[i][j][k];
                            next[j][k][2] += memo[i][j][k];
                            next[j][k][3] += memo[i][j][k];
                        }
                        else if(i == 0 && j == 3 && k == 2){
                            next[j][k][0] += memo[i][j][k];
                            next[j][k][2] += memo[i][j][k];
                            next[j][k][3] += memo[i][j][k];
                        }
                        else if(i == 0 && j == 2 && k == 3){
                            next[j][k][0] += memo[i][j][k];
                            next[j][k][2] += memo[i][j][k];
                            next[j][k][3] += memo[i][j][k];
                        }
                        else{
                            next[j][k][0] += memo[i][j][k];
                            next[j][k][1] += memo[i][j][k];
                            next[j][k][2] += memo[i][j][k];
                            next[j][k][3] += memo[i][j][k];
                        }
                    }
                }
            }

            rep(i, 4){
                rep(j, 4){
                    rep(k, 4){
                        memo[i][j][k] = next[i][j][k] % MOD;
                        // cout << i << " " << j << " " << k << " " << memo[i][j][k] << endl;
                    }
                }
            }

        }

        ll ans = 0;
        rep(i, 4){
            rep(j, 4){
                rep(k, 4){
                    ans = (ans + memo[i][j][k]) % MOD;
                }
            }
        }

        cout << ans;

    }

    return 0;
}

Measured memory_bytes: 256