Constrained strings matrix

Write codeHard35 minCitadel style

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) -> int
Example 1
Inputcount_strings(1)
Output3