public class Euler161 {
    static int W;
    static long[] cur, nxt;

    static boolean bit(int mask, int pos) {
        return ((mask >> pos) & 1) != 0;
    }

    static void dfs(int d, int state, int mask) {
        if (d < 0) {
            if (((mask + 1) & ((1 << W) - 1)) == 0)
                nxt[mask >> W] += cur[state];
            return;
        }
        dfs(d - 1, state, mask);
        if (!bit(mask, d) && !bit(mask, d + W))
            dfs(d - 1, state, mask | (1 << d) | (1 << (d + W)) | (1 << (d + 2 * W)));
        if (d >= 2)
            dfs(d - 3, state, mask | (1 << (d + 2 * W)) | (1 << (d - 1 + 2 * W)) | (1 << (d - 2 + 2 * W)));
        if (d >= 1 && !bit(mask, d + W) && !bit(mask, d + 2 * W - 1))
            dfs(d - 2, state, mask | (1 << (d + W)) | (1 << (d + 2 * W - 1)) | (1 << (d + 2 * W)));
        if (d >= 1 && !bit(mask, d + W - 1) && !bit(mask, d + 2 * W - 1))
            dfs(d - 2, state, mask | (1 << (d + W - 1)) | (1 << (d + 2 * W - 1)) | (1 << (d + 2 * W)));
        if (d >= 1 && !bit(mask, d + W - 1) && !bit(mask, d + W))
            dfs(d - 1, state, mask | (1 << (d + W - 1)) | (1 << (d + W)) | (1 << (d + 2 * W)));
        if (d < W - 1 && !bit(mask, d + W) && !bit(mask, d + W + 1))
            dfs(d - 1, state, mask | (1 << (d + W + 1)) | (1 << (d + W)) | (1 << (d + 2 * W)));
    }

    public static void main(String[] args) {
        W = 9;
        int H = 12;
        int sc = 1 << (2 * W);
        cur = new long[sc];
        nxt = new long[sc];
        cur[sc - 1] = 1;
        for (int r = 0; r < H; r++) {
            for (int s = 0; s < sc; s++) {
                if (cur[s] == 0)
                    continue;
                dfs(W - 1, s, s);
            }
            long[] t = cur;
            cur = nxt;
            nxt = t;
            java.util.Arrays.fill(nxt, 0);
        }
        System.out.println(cur[sc - 1]);
    }
}
