using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoder.Tool;

namespace AtCoder
{
    class AC
    {
        const int MOD = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;
        const double EPS = 1e-8;
        static readonly int[] dx = { 0, 1, 0, -1 };
        static readonly int[] dy = { 1, 0, -1, 0 };

        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            int n = int.Parse(Console.ReadLine());

            var dp = new long[n + 1, 5, 5, 5];
            for(var i = 0; i <= n; i++)
            {
                for(var a = 0; a < 5; a++)
                {
                    for(var b = 0; b < 5; b++)
                    {
                        for(var c = 0; c < 5; c++)
                        {
                            dp[i, a, b, c] = 0;
                        }
                    }
                }
            }
            //0 T, 1 A , 2 G , 3 C ,4 空  i:length
            dp[0, 4, 4, 4] = 1;
            for (var i = 1; i <= n; i++)
            {
                for (var a = 0; a < 5; a++)
                {
                    for (var b = 0; b < 5; b++)
                    {
                        for (var c = 0; c < 5; c++)
                        {
                            for(var x = 0; x < 4; x++)
                            {
                                if (x == 0 || x == 1)
                                {
                                    dp[i, b, c, x] = (dp[i, b, c, x] + dp[i - 1, a, b, c]) % MOD;
                                }
                                else if (x == 2)
                                {
                                    if (b == 1 && c == 3) { continue; }
                                    dp[i, b, c, x] = (dp[i, b, c, x] + dp[i - 1, a, b, c]) % MOD;
                                }
                                else
                                {
                                    if (a == 1 && c == 2) { continue; }
                                    if (a == 1 && b == 2) { continue; }
                                    if (b == 1 && c == 2) { continue; }
                                    if (b == 2 && c == 1) { continue; }
                                    dp[i, b, c, x] = (dp[i, b, c, x] + dp[i - 1, a, b, c]) % MOD;
                                }
                            }
                        }
                    }
                }
            }

            long ans = 0;
            for (var a = 0; a < 4; a++)
            {
                for (var b = 0; b < 4; b++)
                {
                    for (var c = 0; c < 4; c++)
                    {
                        ans = (ans + dp[n, a, b, c]) % MOD;
                    }
                }
            }

            Console.WriteLine(ans);

            //Console.Out.Flush();

        }

        
    }

    


    public class Scanner
    {
        public int[] SplitRead()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReadL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }
    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for (var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
    }

}


Measured memory_bytes: 11192