import Control.Monad
import Data.List

main :: IO ()
main = getLine >> replicateM 2 getLine >>= print . solve 

solve :: [String] -> Int 
solve [s1, s2] = fst $ foldl' ff (initialize s) ss
    where
        (s : ss) = zip s1 s2
        
        initialize (x, y)
            | x == y = (3, s)
            | otherwise = (6, s)
        
        ff (acc, (px, py)) (x, y)
            | px == py = (acc `mul` 2, (x, y))
            | px == x && py == y = (acc, (x, y))
            | x == y = (acc, (x, y))
            | otherwise = (acc `mul` 3, (x, y))

add :: Int -> Int -> Int
add x y = val $ x + y

mul :: Int -> Int -> Int
mul x y = val $ x * y

inv :: Int -> Int
inv x = pow x $ modVal - 2

pow :: Int -> Int -> Int
pow b e
    | e == 0 = 1
    | odd e = mul b . pow b $ e - 1
    | otherwise = mul v v
    where
        v = pow b $ e `div` 2

val :: Int -> Int
val = (`mod` modVal)

modVal :: Int
modVal = 10 ^ 9 + 7

primes :: [Int]
primes = build [2..]
    where
        build (x : xs) = x : build (filter (\n -> n `mod` x /= 0) xs)
        
isPrime :: Int -> Bool
isPrime n = check primes
    where
        check (x : xs)
            | x == n = True
            | x > n = False
            | otherwise = check xs