#[allow(unused_macros)]
macro_rules! p {
    ($x:expr $(, $tail:expr)*) => {
        let mut s = String::new();
        s.push_str(format!("{:?}", $x).as_str());
        $(
            s.push_str(format!(", {:?}", $tail).as_str());
        )*
        println!("{}", s);
    };
}

#[allow(unused_macros)]
macro_rules! pl {
    ($($x:expr), *) => {
        $(println!("{:?}", $x);)*
    };
}

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    println!("{}", solve(stdin!()));
}

const MOD: usize = 1_000_000_007;

fn solve(src: String) -> String {
    input! {
        source = src,
        n: usize
    }
    let mut dp = vec![vec![vec![vec![0; 4]; 4]; 4]; n+1];
    dp[0][3][3][3] = 1;
    for len in 0..n {
        for i in 0..4 {
            for j in 0..4 {
                for k in 0..4 {
                    if dp[len][i][j][k] == 0 {
                        continue;
                    }

                    for a in 0..4 {
                        match (k,j,i,a) {
                            (_,0,1,2) => continue,
                            (_,0,2,1) => continue,
                            (_,1,0,2) => continue,
                            (0,_,1,2) => continue,
                            (0,1,_,2) => continue,
                            _ => {
                                dp[len+1][a][i][j] += dp[len][i][j][k];
                                dp[len+1][a][i][j] %= MOD;
                            }
                        }
                    }
                }
            }
        }
    }
    let mut ans = 0;
    for i in 0..4 {
        for j in 0..4 {
            for k in 0..4 {
                ans += dp[n][i][j][k];
                ans %= MOD;
            }
        }
    }
    ans.to_string()
}

// Test Code

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input.to_string()), $output);
            )*
        }
    };
}

test! {
    "3" => "61",
    "4" => "230",
    "100" => "388130742",
}


Measured memory_bytes: 4352