Constrained strings matrix
Your task
Count the number of distinct strings of length n over the alphabet {a, b, c} such that no two adjacent characters are equal AND the string never contains 'a' immediately followed by 'b'. Because n can be as large as 10^18, you must use matrix exponentiation; return the count modulo 1000000007. For n = 0 there is exactly one string (the empty string).
Examples
count_strings(n: int) -> intExample 1
Input
count_strings(1)Output
3