using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramD a = new ProgramD();
            a.main();//実行する

        }

    }

    class ProgramA
    {
        public void main()
        {
            //入力
            string s = Console.ReadLine();

            //対になる塩基を出す
            if (s == "A")
                Console.WriteLine("T");
            else if (s == "T")
                Console.WriteLine("A");
            else if (s == "G")
                Console.WriteLine("C");
            else
                Console.WriteLine("G");

        }
    }

    class ProgramB
    {
        public void main()
        {

            //入力
            string s = Console.ReadLine();

            int ans = 0;

            //先頭から調べていく
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != 'A' && s[i] != 'T' && s[i] != 'C' && s[i] != 'G')
                    continue;

                int count = 0;

                for (int j = i; j < s.Length; j++)
                {
                    if (s[j] == 'A' || s[j] == 'T' || s[j] == 'C' || s[j] == 'G')
                    {
                        count++;
                    }
                    else
                        break;
                }

                ans = Math.Max(ans, count);
            }

            //答え出力
            Console.WriteLine(ans);
            

        }
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            string[] ss = Console.ReadLine().Split(' ');
            int n = int.Parse(ss[0]);
            int q = int.Parse(ss[1]);
            string s = Console.ReadLine();

            //i文字目までにACが何個あるか記録する
            int[] AC = new int[n + 1];
            int count = 0;

            for(int i = 2; i <= n;i++)
            {
                if (s[i - 1] == 'C' && s[i - 2] == 'A')
                    count++;
                AC[i] = count;
            }

            for(int i = 0;i < q;i++)
            {
                string[] temp = Console.ReadLine().Split(' ');

                Console.WriteLine(AC[int.Parse(temp[1])] - AC[int.Parse(temp[0])]);
            }

        }


    }


    class ProgramD
    {
        public void main()
        {

            //入力
            int n = int.Parse(Console.ReadLine());
            long MOD = 1000000000 + 7;
            long[,,,] dp = new long[n, 4, 4, 4];

            

            //初項
            for (int k = 0; k < 4; k++)//2つ前
                for (int l = 0; l < 4; l++)//一つ前
                    for (int m = 0; m < 4; m++)//今
                    {
                        if ((k == 0 && l == 2 && m == 1) || (k == 0 && l == 1 && m == 2) || (k == 2 && l == 0 && m == 1))
                            continue;

                        dp[2, k, l, m] = 1;
                    }


            //動的計画法
            for (int i = 3; i < n; i++)//4文字目から見る
                for (int j = 0; j < 4; j++)//3つ前
                    for (int k = 0; k < 4; k++)//2つ前
                        for (int l = 0; l < 4; l++)//一つ前
                            for (int m = 0; m < 4; m++)//今参照してる列
                            {
                                // [A, C, G, T]
                                // _AG -> C (0,2,1)
                                // _AC -> G (0,1,2)
                                // _GA -> C (2,0,1)
                                // AG_ -> C (0,2,X,1)
                                // A_G -> C (0,X,2,1)
                                if ((k == 0 && l == 2 && m == 1) || (k == 0 && l == 1 && m == 2) ||
                                    (k == 2 && l == 0 && m == 1) || (j == 0 && k == 2 && m == 1) || (j == 0 && l == 2 && m == 1))
                                    continue;

                                dp[i, k, l, m] += dp[i - 1, j, k, l];
                                dp[i, k, l, m] %= MOD;


                            }

            long ans = 0;

            for (int k = 0; k < 4; k++)//2つ前
                for (int l = 0; l < 4; l++)//一つ前
                    for (int m = 0; m < 4; m++)//今
                    {
                        ans += dp[n -1, k, l, m];
                        ans %= MOD;
                    }


            Console.WriteLine(ans);

        }

        

    }

    


}




    

Measured memory_bytes: 11184