mod=10**9+7
n=gets.to_i
dp=(0..n).map{{}}
dp[0]['TTT']=1
n.times{|i|
    dp[i].each{|k, v|
        a, b, c=k.chars
        'ACGT'.chars{|d|
            next if (a+b+c+d)['AGC']
            next if (b+a+c+d)['AGC']
            next if (a+c+b+d)['AGC']
            next if (a+b+d+c)['AGC']
            s=b+c+d
            dp[i+1][s]=dp[i+1][s].to_i+v
            dp[i+1][s]%=mod
        }
    }
}
puts dp[n].values.inject(:+)%mod