using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC122D
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt;

            long[,] dp = new long[N, 64];
            for (int j = 0; j < 64; j++)
            {
                if (j == 6 || j == 9 || j == 18) continue;
                dp[0, j] = 1;
            }

            Draw2D(dp);

            for (int i = 0; i < N - 1; i++)
            {
                for (int j = 0; j < 64; j++)
                {
                    for (int k = 0; k < 4; k++)
                    {
                        //nextが特定の値の時（AGC）のときcontinue
                        int next = j * 4 % 64 + k;
                        if (next == 6 || next == 9 || next == 18) continue;
                        if (k == 2)
                        {
                            if (j / 16 == 0 && j / 4 == 1) continue;
                            if (j / 16 == 0 && j % 4 == 1) continue;
                        }

                        dp[i + 1, next] += dp[i, j];
                        dp[i + 1, next] %= 1000000007;
                    }
                }
            }

            Draw2D(dp);

            long ans = 0;
            for (int i = 0; i < 64; i++)
            {
                ans += dp[N - 3, i];
                ans %= 1000000007;
            }
            Console.WriteLine(ans);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        static public void Draw2D(long[,] map, long mode = 1)
        {
#if DEBUG
            long W = map.GetLength(0);
            long H = map.GetLength(1);

            long[,] map2 = new long[W + 1, H + 1];
            for (long i = 0; i < W + 1; i++)
            {
                for (long j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0;
                    else if (i == 0) map2[i, j] = j - 1;
                    else if (j == 0) map2[i, j] = i - 1;
                    else map2[i, j] = map[i - 1, j - 1];
                }
            }

            for (long i = 0; i < W + 1; i++)
            {
                for (long j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j] % 10);
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        static void Draw1D(int[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 11220