import Data.List
main = do
 _ <- getLine
 s1 <- getLine
 s2 <- getLine
 print $(`mod` 1000000007)$analyze s1


analyze :: String -> Integer
analyze str = foo $ map length $ group str

foo :: [Int] -> Integer
foo [] = 1
foo [1] = 3
foo [2] = 3
foo (1:1:xs) = (`mod` 1000000007)$2 * foo(1:xs)
foo (2:1:xs) = (`mod` 1000000007)$2 * foo(1:xs)
foo (1:2:xs) = (`mod` 1000000007)$1 * foo(2:xs)
foo (2:2:xs) = (`mod` 1000000007)$3 * foo(2:xs)