// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define PI          acos(-1)

#define INF         100000000

#define sc(n)       scanf("%d",&n);

#define ssc(n)      scanf("%s",n);

#define lsc(n)      scanf("%lld",&n);

#define dsc(n)      scanf("%lf",&n);

#define csc(n)       scanf("%c",&n);

#define LL          long long int

#define UI          unsigned int

#define ULL         unsigned long long int

#define DB          double

#define pii         pair<int,int>

#define VI          vector<int>

#define MII         map<int,int>

#define PB          push_back

#define MP          make_pair

#define M(mx,a)     mx=max(mx,a)

#define IT          ::iterator

#define all(a)      a.begin(),a.end()

#define mems(a,b)   memset(a,b,sizeof(a))

#define F(i,a,b)    for(i=a;i<b;i++)

#define IN(n,aa)    for(i=0;i<n;i++)scanf("%d",&aa[i]);

#define PNT(n,aa)   for(i=0;i<n;i++)printf("%lld ",aa[i]);

#define mod         1000000007

#define NUM         109

#define NUM2        1000000000



char ch[] = {'A','C','G','T'};

int dd[109][10][10][10];

bool ck(int x,int y,int z)

{

    string ss="";

    ss.PB(ch[x]);

    ss.PB(ch[y]);

    ss.PB(ch[z]);

    if(ss=="AGC")return 0;

    return 1;

}



int solve(int n)

{

    int i,j,k,l,ii;

    for(i=0;i<4;i++)

        for(j=0;j<4;j++)

            for(k=0;k<4;k++)

                if(ck(i,j,k)&&ck(i,k,j)&&ck(j,i,k))

                {

                    dd[3][i][j][k]=1;

                }

    for(l=4;l<=n;l++)

        for(i=0;i<4;i++)

            for(j=0;j<4;j++)

                for(k=0;k<4;k++)

                    for(ii=0;ii<4;ii++)

                        if(ck(i,j,k)&&ck(ii,i,k)&&ck(ii,j,k)&&ck(i,k,j)&&ck(j,i,k))

                        {

                            dd[l][i][j][k]+=dd[l-1][ii][i][j]%mod;

                            dd[l][i][j][k]%=mod;

                        }

    int cnt=0;

    for(i=0;i<4;i++)

        for(j=0;j<4;j++)

            for(k=0;k<4;k++) cnt+=dd[n][i][j][k],cnt%=mod;

    return cnt;

}

int main()

{

    int T=1,QQ=0;

    //cin >> T ;

    while(T--)

    {

        int N;

        cin >> N ;

        cout << solve(N);

    }

}



//printf("Case %d: ",++QQ);


// Faster C++ solution for the same problem (measured speedup: 1.9819697982721243x):
//#pragma GCC optimize("Ofast")

//#pragma GCC target("avx,avx2,fma")



#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;



#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)

typedef long long int lli;

typedef pair<int, int> pi;

typedef pair<int, pi> node;

#define oset tree<pi, null_type,greater<pi>, rb_tree_tag,tree_order_statistics_node_update>



lli dp[105][4][4][4], mod = 1e9+7;

int n;



lli call(int in, int i, int j, int k)

{

    if(i==0 && j==2 && k==1) return 0;

    if(i==2 && j==0 && k==1) return 0;

    if(i==0 && j==1 && k==2) return 0;



    if(in == n) return 1;

    lli &ret = dp[in][i][j][k];

    if(ret != -1) return ret;



    ret = 0;

    for(int x=0; x<4; x++){

        if(i==0 && k==2 && x==1);

        else if(i==0 && j==2 && x==1);

        else ret = (ret+call(in+1, j, k, x))%mod;

    }

    return ret;

}



int main()

{

    cin >> n;

    if(n == 1){

        printf("4\n");

        return 0;

    }

    else if(n == 2){

        printf("16\n");

        return 0;

    }

    else if(n == 3){

        printf("61\n");

        return 0;

    }



    memset(dp, -1, sizeof(dp));



    lli ans = 0;

    for(int i=0; i<4; i++){

        for(int j=0; j<4; j++){

            for(int k=0; k<4; k++){

                ans = (ans+call(3, i, j, k))%mod;

            }

        }

    }

    cout << ans << "\n";



    return 0;

}