#include <iostream>

using namespace std;

const u_int64_t R = 1'000'000'007LL;
u_int64_t dp[101][26][26][26][26];
const char ch[4] = {'A', 'C', 'G', 'T'};

u_int64_t dpsum(int n)
{
    u_int64_t s = 0;
    for (const char c0 : ch)
        for (const char c1 : ch)
            for (const char c2 : ch)
                for (const char c3 : ch)
                {
                    const int idx0 = c0 - 'A';
                    const int idx1 = c1 - 'A';
                    const int idx2 = c2 - 'A';
                    const int idx3 = c3 - 'A';
                    s = (s + dp[n][idx0][idx1][idx2][idx3]) % R;
                }

    return s;
}

int main()
{
    int n;
    cin >> n;

    for (int i = 3; i <= n; i++)
    {
        if (i == 3)
        {
            for (const char c0 : ch)
                for (const char c1 : ch)
                    for (const char c2 : ch)
                        for (const char c3 : ch)
                        {
                            const int idx0 = c0 - 'A';
                            const int idx1 = c1 - 'A';
                            const int idx2 = c2 - 'A';
                            const int idx3 = c3 - 'A';

                            if (
                                (c0 == 'A' && c1 == 'G' && c2 == 'C') ||
                                (c0 == 'A' && c1 == 'G' && c3 == 'C') ||
                                (c0 == 'A' && c2 == 'G' && c3 == 'C') ||
                                (c1 == 'A' && c2 == 'G' && c3 == 'C') ||
                                (c0 == 'G' && c1 == 'A' && c2 == 'C') ||
                                (c1 == 'G' && c2 == 'A' && c3 == 'C') ||
                                (c0 == 'A' && c1 == 'C' && c2 == 'G') ||
                                (c1 == 'A' && c2 == 'C' && c3 == 'G'))
                            {
                                dp[i][idx0][idx1][idx2][idx3] = 0;
                            }
                            else if (c0 == 'T')
                            {
                                dp[i][idx0][idx1][idx2][idx3] = 1;
                            }
                            else
                            {
                                dp[i][idx0][idx1][idx2][idx3] = 0;
                            }
                        }
        }
        else
        {
            for (const char c0 : ch)
                for (const char c1 : ch)
                    for (const char c2 : ch)
                        for (const char c3 : ch)
                        {
                            const int idx0 = c0 - 'A';
                            const int idx1 = c1 - 'A';
                            const int idx2 = c2 - 'A';
                            const int idx3 = c3 - 'A';
                            if (
                                (c0 == 'A' && c1 == 'G' && c2 == 'C') ||
                                (c0 == 'A' && c1 == 'G' && c3 == 'C') ||
                                (c0 == 'A' && c2 == 'G' && c3 == 'C') ||
                                (c1 == 'A' && c2 == 'G' && c3 == 'C') ||
                                (c0 == 'G' && c1 == 'A' && c2 == 'C') ||
                                (c1 == 'G' && c2 == 'A' && c3 == 'C') ||
                                (c0 == 'A' && c1 == 'C' && c2 == 'G') ||
                                (c1 == 'A' && c2 == 'C' && c3 == 'G'))
                            {
                                dp[i][idx0][idx1][idx2][idx3] = 0;
                            }
                            else
                            {
                                u_int64_t s = 0;
                                for (const char c : ch)
                                {
                                    s = (s + dp[i - 1][c - 'A'][idx0][idx1][idx2]) % R;
                                }
                                dp[i][idx0][idx1][idx2][idx3] = s;
                            }
                        }
        }
    }

    const u_int64_t result = dpsum(n);

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 350464