#pragma warning disable

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;


static class MainClass
{
    public static void Main(string[] args)
    {
        
        

        var n = Console.ReadLine().ToInt32();
        var agct = new char[] { 'A', 'G', 'C', 'T' };
        var strlen = 4;
        var based = NBasedSearch(4, strlen);
        var kouho = new List<string>();

        foreach (var item in based)
        {
            var str = "";
            foreach (var item2 in item)
            {
                str += agct[item2];
            }
            kouho.Add(str);
        }
        //var agcind = kouho.FindIndex(x => x == "AGC");
        //var gacind = kouho.FindIndex(x => x == "GAC");
        //var acgind = kouho.FindIndex(x => x == "ACG");
        var kouhodic = new Dictionary<string, int>();
        var outedind = new List<int>();
        var len = kouho.Count;
        var iii = 0;
        foreach (var item in kouho)
        {
            //iii = kouho.FindIndex(x => x == item);
            kouhodic.Add(item, iii);
            if (item.Contains("AGC") || item.Contains("GAC") || item.Contains("ACG")/* || item == "ATGC" || item == "AGGC" || item == "AGTC"*/)
            {
                outedind.Add(iii);
            }
            else
            {
                for (int i = 0; i < strlen - 1; i++)
                {
                    var ichar = item[i];
                    var ippchar = item[i + 1];
                    var newstr = item.Substring(0, i) + ippchar + ichar + item.Substring(i + 2);
                    if (newstr.Contains("AGC"))
                    {
                        outedind.Add(iii);
                        break;
                    }
                }
            }
            iii++;
        }
        //// test begin
        //var tests = NBasedSearch(4, n);
        //var testls = new List<string>();
        //foreach (var item in tests)
        //{
        //    var str = "";
        //    foreach (var item2 in item)
        //    {
        //        str += agct[item2];
        //    }
        //    testls.Add(str);
        //}

        //var afford = new List<string>();
        //foreach (var item in testls)
        //{
        //    var isok = true;
        //    for (int i = 0; i < item.Length - 3; i++)
        //    {
        //        var strs = item.Substring(i, strlen);
        //        if (strs.Length == strlen && outedind.Contains(kouhodic[strs]))
        //        {
        //            isok = false;
        //        }
        //    }
        //    if (isok)
        //    {
        //        afford.Add(item);
        //    }
        //}
        //Console.WriteLine(afford.Count);
        // test end
        if (n == 3)
        {
            Console.WriteLine(61);
            return;
        }else if (n == 4)
        {
            Console.WriteLine(230);
            return;
        }
        var dp = new BigInteger[n + 3, len];

        for (int i = 0; i < len; i++)
        {
            if (!outedind.Contains(i))
            {
                dp[4, i] = 1;
            }
        }
        for (int i = 4; i < n; i++)
        {
            for (int j = 0; j < len; j++)
            {
                if (!outedind.Contains(j))
                {
                    var str = kouho[j];
                    str = str.Remove(strlen - 1, 1);
                    var aadded = "A" + str;
                    var gadded = "G" + str;
                    var cadded = "C" + str;
                    var tadded = "T" + str;
                    BigInteger suminter = 0l;
                    var aind = kouhodic[aadded];
                    var gind = kouhodic[gadded];
                    var cind = kouhodic[cadded];
                    var tind = kouhodic[tadded];
                    if (!outedind.Contains(aind))
                        suminter += dp[i, aind];
                    if (!outedind.Contains(cind))
                        suminter += dp[i, cind];
                    if (!outedind.Contains(gind))
                        suminter += dp[i, gind];
                    if (!outedind.Contains(tind))
                        suminter += dp[i, tind];
                    dp[i + 1, j] = suminter/* % Mod1e9*/;
                }
                else
                    dp[i + 1, j] = 0;
            }
        }
        BigInteger sum = 0l;
        for (int i = 0; i < len; i++)
        {
            if (outedind.Contains(i))
            {
                continue;
            }
            sum += dp[n, i]/* % Mod1e9*/;
        }
        Console.WriteLine(sum % Mod1e9);

        Console.ReadLine();
    }


    public static List<List<int>> NBasedSearch(int n, int length)
    {
        if (length == 1)
        {
            var ls = new List<List<int>>();
            for (int i = 0; i < n; i++)
            {
                var lss = new List<int>();
                lss.Add(i);
                ls.Add(lss);
            }
            return ls;
        }
        else
        {
            var ans = NBasedSearch(n, length - 1);
            var news = new List<List<int>>();
            foreach (var item in ans)
            {
                for (int i = 0; i < n; i++)
                {
                    var based = item.ToList();
                    based.Add(i);
                    news.Add(based);
                }
            }
            return news;

        }
    }

    #region
    public static int ParentCount;

    public static int[] Parents;
    public static int[] IfParentsChildrenCount;

    public static int[] Ranks;

    public static void InitializeUnionFind(int N)
    {
        Parents = new int[N];
        Ranks = new int[N];
        IfParentsChildrenCount = new int[N];
        for (int i = 0; i < N; i++)
        {
            Parents[i] = i;
            Ranks[i] = 0;
            IfParentsChildrenCount[i] = 1;
        }
        ParentCount = N + 1;
    }

    public static int Root(int a)
    {
        if (Parents[a] == a)
        {
            return a;
        }
        else
        {
            Parents[a] = Root(Parents[a]);
            return Parents[a];
        }
    }

    public static bool Same(int a, int b)
    {
        return Root(a) == Root(b);
    }

    public static void Unite(int a, int b)
    {
        var parentA = Root(a);
        var parentB = Root(b);
        if (parentA == parentB)
            return;
        if (Ranks[parentA] < Ranks[parentB])
        {
            Parents[parentA] = parentB;
            IfParentsChildrenCount[parentB] += IfParentsChildrenCount[parentA];
            ParentCount -= IfParentsChildrenCount[parentA];

            IfParentsChildrenCount[parentA] = 0;
        }
        else
        {
            Parents[parentB] = parentA;
            if (Ranks[parentA] == Ranks[parentB])
            {
                Ranks[parentA]++;
            }
            IfParentsChildrenCount[parentA] += IfParentsChildrenCount[parentB];
            ParentCount -= IfParentsChildrenCount[parentB];
            IfParentsChildrenCount[parentB] = 0;
        }
    }
    #endregion
    #region ライブラリ

    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => str == "" ? 0 : int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 4;
    public const long LONGINF = long.MaxValue / 2;
    public const int Mod1e9 = 1000000007;

    public static void PrintArray(char[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < array.GetLength(1); j++)
            {
                sb.Append(array[i, j]);
            }
            Console.WriteLine(sb.ToString());
        }
    }
    public static int Manhattan(int x1, int x2, int y1, int y2)
    {
        return Math.Abs(x1 - x2) + Math.Abs(y1 - y2);
    }

    public static Dictionary<T, int> ToCountedDictionary<T>(this IEnumerable<T> items)
    {
        var dic = new Dictionary<T, int>();
        foreach (var item in items)
        {
            if (dic.ContainsKey(item))
                dic[item]++;
            else
                dic.Add(item, 1);
        }
        return dic;
    }
    public static Dictionary<TKey,TValue> KeyValuePairListToDictionary<TKey,TValue>(this IEnumerable<KeyValuePair<TKey,TValue>> pairs)
    {
        var dic = new Dictionary<TKey, TValue>();
        foreach (var item in pairs)
        {
            dic.Add(item.Key, item.Value);
        }
        return dic;
    }

    public static long Sums(IEnumerable<int> list)
    {
        var sum = 0l;
        foreach (var item in list)
        {
            sum += item;
        }
        return sum;
        #endregion
    }

    public static int[] dx = { -1, 1, 0, 0 };
    public static int[] dy = { 0, 0, 1, -1 };

    public static int[] dxx = { 0, 1, 1, 1, 0, -1, -1, -1 };
    public static int[] dyy = { 1, 1, 0, -1, -1, -1, 0, 1 };
}



Measured memory_bytes: 20956