// Original C++ solution (slower):
#include <bits/stdc++.h> 



using namespace std; 

using ll = long long;

using ull = unsigned long long;

using pii = pair<int,int>; 



#define INF (INT_MAX)/2-1

#define MOD 1000000007

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

#define rrng(a) a.rbegin(),a.rend()



// 0->nan 1-> A 2->C 3->G 4->T

int main(){

  int N;

  cin>>N;

  using v1=vector<ll>;

  using v2=vector<v1>;

  using v3=vector<v2>;

  using v4=vector<v3>;

  using v5=vector<v4>;

  v5 dp(N,v4(5,v3(5,v2(5,v1(5,0)))));

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

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

      dp[i][j][0][0][0]=1;

    }

    else if(i==1)for(int j=1;j<=4;j++)for(int k=1;k<=4;k++){

      dp[i][j][k][0][0]+=dp[i-1][k][0][0][0];

      dp[i][j][k][0][0]%=MOD;

    }

    else if(i==2)for(int j=1;j<=4;j++)for(int k=1;k<=4;k++)for(int l=1;l<=4;l++){

      if(j==2&&k==3&&l==1){}

      else if(j==3&&k==2&&l==1){}

      else if(j==2&&k==1&&l==3){}

      else dp[i][j][k][l][0]+=dp[i-1][j][l][0][0];

      dp[i][j][k][l][0]%=MOD;

    }

    else if(i==3)for(int j=1;j<=4;j++)for(int k=1;k<=4;k++)for(int l=1;l<=4;l++)

      for(int m=1;m<=4;m++){

        if(j==2&&k==3&&l==1){}

        else if(j==3&&k==2&&l==1){}

        else if(j==2&&k==1&&l==3){}

        else if(j==2&&k==3&&m==1){}

        else if(j==2&&l==3&&m==1){}

        else dp[i][j][k][l][m]+=dp[i-1][k][l][m][0];

        dp[i][j][k][l][m]%=MOD;

    }

    else for(int j=1;j<=4;j++)for(int k=1;k<=4;k++)for(int l=1;l<=4;l++)

      for(int m=1;m<=4;m++)for(int n=1;n<=4;n++){

        if(j==2&&k==3&&l==1){}

        else if(j==3&&k==2&&l==1){}

        else if(j==2&&k==1&&l==3){}

        else if(j==2&&k==3&&m==1){}

        else if(j==2&&l==3&&m==1){}

        else dp[i][j][k][l][m]+=dp[i-1][k][l][m][n];

        dp[i][j][k][l][m]%=MOD;

    }

  }

  ll sum=0;

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

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

      for(int l=0;l<5;l++){

        for(int m=0;m<5;m++){

          sum+=dp[N-1][j][k][l][m];

          sum%=MOD;

        }

      }

    }

  }

  cout<<sum<<endl;

  return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h> 



using namespace std;

using ll=long long;

using ull=unsigned long long;

using pii=pair<int,int>;



#define INF LONG_MAX

#define MOD 1000000007

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

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





int main(){

  ios::sync_with_stdio(false);

  cin.tie(0);



  int N;

  cin>>N;

  // now,back,back2,back3

  using vec1=vector<int>;

  using vec2=vector<vec1>;

  using vec3=vector<vec2>;

  using vec4=vector<vec3>;

  vec4 dp(N+1,vec3(5,vec2(5,vec1(5,0))));

  // AGC

  // ACG

  // GAC

  // A.GC

  // AG.C

  // 1->A 2->G 3->C 4->T

#define A 1

#define G 2

#define C 3

#define T 4

  dp[0][0][0][0]=1;

  for(int i=1;i<=N;i++){

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

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

        for(int l=0;l<5;l++){

          for(int x=1;x<5;x++){

            if(x==C&&j==G&&k==A){}

            else if(x==G&&j==C&&k==A){}

            else if(x==C&&j==A&&k==G){}

            else if(x==C&&j==G&&l==A){}

            else if(x==C&&k==G&&l==A){}

            else dp[i][x][j][k]+=dp[i-1][j][k][l]%MOD;

            dp[i][x][j][k]%=MOD;

          }

        }

      }

    }

  }



  ll ans=0;

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

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

      for(int l=0;l<5;l++){

        ans+=dp[N][j][k][l]%MOD;

        ans%=MOD;

      }

    }

  }

  cout<<ans<<endl;



  return 0;

}


// Fastest known solution for this problem: