using System;
using System.Linq;
using System.Collections.Generic;
using Library;
using static Library.Comfort;
using static Library.Math;
using static Library.Algorithm;
using static System.Math;
using System.Threading.Tasks;

namespace AtCoderer
{
    public class App
    {
        const int A = 0;
        const int G = 2;
        const int C = 1;
        const int T = 3;
        public static void Solve()
        {
            //AGC A_GC AG_C GAC ACG
            int n = Parse() - 1;
            var dp = new long[4, 4, 4, 4, n+1];
            dp[3, 3, 3,3 , 0] = 1;
            for(int i = 1;i<=n;i++)
            {
                for (int c1 = 0; c1 < 4; c1++)
                {
                    for (int c2 = 0; c2 < 4; c2++)
                    {
                        for (int c3 = 0; c3 < 4; c3++)
                        {
                            for (int c4 = 0; c4 < 4; c4++)
                            {
                                if (c2 == A && c3 == G && c4 == C)
                                    continue;
                                if (c2 == G && c3 == A && c4 == C)
                                    continue;
                                if (c2 == A && c3 == C && c4 == G)
                                    continue;
                                if (c1 == A && c2 == G && c4 == C)
                                    continue;
                                if (c1 == A && c3 == G && c4 == C)
                                    continue;
                                dp[c1, c2, c3, c4, i] += dp[0, c1, c2, c3, i-1];
                                dp[c1, c2, c3, c4, i] += dp[1, c1, c2, c3, i-1];
                                dp[c1, c2, c3, c4, i] += dp[2, c1, c2, c3, i-1];
                                dp[c1, c2, c3, c4, i] += dp[3, c1, c2, c3, i-1];
                                dp[c1, c2, c3, c4, i] %= mod;
                            }
                        }
                    }
                }
            }
            long sum = 0;
            for (int c1 = 0; c1 < 4; c1++)
            {
                for (int c2 = 0; c2 < 4; c2++)
                {
                    for (int c3 = 0; c3 < 4; c3++)
                    {
                        for (int c4 = 0; c4 < 4; c4++)
                        {
                            if (c2 == A && c3 == G && c4 == C)
                                continue;
                            if (c2 == G && c3 == A && c4 == C)
                                continue;
                            if (c2 == A && c3 == C && c4 == G)
                                continue;
                            if (c1 == A && c2 == G && c4 == C)
                                continue;
                            if (c1 == A && c3 == G && c4 == C)
                                continue;
                            sum += dp[0, c1, c2, c3, n];
                            sum += dp[1, c1, c2, c3, n];
                            sum += dp[2, c1, c2, c3, n];
                            sum += dp[3, c1, c2, c3, n];
                            sum %= mod;
                        }
                    }
                }
            }
            Console.WriteLine(sum);
        }
        public static void Main(string[] args)
        {
            Solve();
            Console.ReadKey();
        }
        public static int To4(char c)
        {
            switch(c)
            {
                case 'A':
                    return 0;
                case 'C':
                    return 1;
                case 'G':
                    return 2;
                case 'T':
                    return 3;
                default:
                    throw new NotSupportedException();
            }
        }
    }
}
namespace Library
{ 
    public static class Comfort
    {
        public class Point
        {
            public int a;
            public int b;
            public Point(int x, int y)
            {
                a = x;
                b = y;
            }
        }
        public const int mod = 1000000007;
        public static int[] OrderBy(this int[] IArr)
        {
            int[] arr = new int[IArr.Length];
            Array.Copy(IArr, arr, IArr.Length);
            Array.Sort(arr);
            return arr;
        }
        public static char[] OrderBy(this string IArr)
        {
            char[] arr = new char[IArr.Length];
            Array.Copy(IArr.ToCharArray(), arr, IArr.Length);
            Array.Sort(arr);
            return arr;
        }
        public static int Max(params int[] p) => p.Max();
        public static long Max(params long[] p) => p.Max();
        public static int Min(params int[] p) => p.Min();
        public static long Min(params long[] p) => p.Min();
        public static int Parse()
        {
            return int.Parse(Console.ReadLine());
        }
        public static int[] ParseArray(this string s)
        {
            return s.Split().Select(v => int.Parse(v)).ToArray();
        }
        public static long[] ParseArrayL(this string s)
        {
            return s.Split().Select(v => long.Parse(v)).ToArray();
        }
        public static int[] ParseArray()
        {
            return Console.ReadLine().Split().Select(v => int.Parse(v)).ToArray();
        }
        public static long[] ParseArrayL()
        {
            return Console.ReadLine().Split().Select(v => long.Parse(v)).ToArray();
        }
        public static void ParseArray(out int a, out int b)
        {
            var r = Console.ReadLine().Split().Select(v => int.Parse(v)).ToArray();
            a = r[0];
            b = r[1];
        }
        public static void ParseArray(out int a, out int b, out int c)
        {
            var r = Console.ReadLine().Split().Select(v => int.Parse(v)).ToArray();
            a = r[0];
            b = r[1];
            c = r[2];
        }
        public static void ParseArray(out int a, out int b, out int c, out int d)
        {
            var r = Console.ReadLine().Split().Select(v => int.Parse(v)).ToArray();
            a = r[0];
            b = r[1];
            c = r[2];
            d = r[3];
        }
        public static void ParseArray(out long a, out long b)
        {
            var r = Console.ReadLine().Split().Select(v => long.Parse(v)).ToArray();
            a = r[0];
            b = r[1];
        }
        public static void ParseArray(out long a, out long b, out long c)
        {
            var r = Console.ReadLine().Split().Select(v => long.Parse(v)).ToArray();
            a = r[0];
            b = r[1];
            c = r[2];
        }
        public static void ParseArray(out long a, out long b, out long c, out long d)
        {
            var r = Console.ReadLine().Split().Select(v => long.Parse(v)).ToArray();
            a = r[0];
            b = r[1];
            c = r[2];
            d = r[3];
        }
        public static string ToString(this IEnumerable<char> v)
        {
            return string.Join("", v);
        }
        public static string Join<T>(this IEnumerable<T> v, char c)
        {
            return string.Join(c.ToString(), v);
        }
        public static string Join<T>(this IEnumerable<T> v, string s)
        {
            return string.Join(s, v);
        }
        public static int[] ReadArr
        {
            get
            {
                return Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            }
        }
    }
    public static class Math
    {
        public static bool IsNatural(this float v) => v - (int)v == 0;
        public static bool IsNatural(this double v) => v - (int)v == 0;
        public static long nCm(long n, long m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m % 1000000007;
        }
        public static IEnumerable<int> Factor(int n)
        {
            int i = 2;
            int tmp = n;

            while (i * i <= n)
            {
                if (tmp % i == 0)
                {
                    tmp /= i;
                    yield return i;
                }
                else
                {
                    i++;
                }
            }
            if (tmp != 1) yield return tmp;
        }
        public static int Gcd(int a, int b) => a > b ? GcdRecursive(a, b) : GcdRecursive(b, a);
        private static int GcdRecursive(int x, int y) => y == 0 ? x : GcdRecursive(y, x % y);
        public static long Gcd(long a, long b) => a > b ? GcdRecursive(a, b) : GcdRecursive(b, a);
        private static long GcdRecursive(long x, long y) => y == 0 ? x : GcdRecursive(y, x % y);
        public static long Lcm(int a, int b) => ((long)a) * b / Gcd(a, b);
    }
    public static class Algorithm
    {
        public class EnumAll
        {
            bool Over = false;
            int UpperValue;
            int Dimension;
            public int[] Current { private set; get; }
            public EnumAll(int Value, int Dimension)
            {
                this.Dimension = Dimension;
                UpperValue = Value;
                Current = new int[Dimension];
                Current[0] = -1;
            }
            public bool Next()
            {
                if (Over)
                    return false;
                bool flag = false;
                for (int i = 0; i < Dimension; i++)
                {
                    if (++Current[i] >= UpperValue)
                        Current[i] = 0;
                    else
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    Over = true;
                    return false;
                }
                return true;
            }
            public bool IsOver()
            {
                return Over;
            }
        }
        public class UnionFind
        {
            private int[] Parent;
            private int GetRoot(int v)
            {
                if (Parent[v] < 0)
                    return v;
                else
                    return Parent[v] = GetRoot(Parent[v]);
            }
            public UnionFind(int size)
            {
                Parent = new int[size];
                for (int i = 0; i < size; i++)
                    Parent[i] = -1;
            }
            public bool AreGrouped(int a, int b)
            {
                return GetRoot(a) == GetRoot(b);
            }
            public void Connect(int a, int b)
            {
                a = GetRoot(a);
                b = GetRoot(b);
                if (a == b) return;
                if (Parent[b] < Parent[a])
                {
                    Parent[b] += Parent[a];
                    Parent[a] = b;
                }
                else
                {
                    Parent[a] += Parent[b];
                    Parent[b] = a;
                }
            }
            public int GetGroupSize(int a)
            {
                return -Parent[GetRoot(a)];
            }
        }
    }
}


Measured memory_bytes: 13120