class Solution: def numOfWays(self, n: int) -> int: a, b, m = 6, 6, 10**9+7 for i in range(n-1): a, b = 2*a+2*b, 2*a + 3*b a %= m b %= m return (a+b)%m