output_description: Print the number of such ways to paint the dominoes, modulo 1000000007.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      S_1
      S_2
attempt: N = int(input())
  S = [input() for _ in range(2)]
  M = 1000000007
  
  if S[0][0] == S[1][0]:
      last_kind = 0
      ans = 3
      i = 1
  else:
      last_kind = 1
      ans = 6
      i = 2
  while i < N:
      if last_kind == 0 and S[0][i] == S[1][i]:
          ans *= 2
          last_kind = 0
          i += 1
      elif last_kind == 1 and S[0][i] == S[1][i]:
          last_kind = 0
          i += 1
      elif last_kind == 0 and S[0][i] == S[0][i+1]:
          ans *= 2
          last_kind = 1
          i += 2
      elif last_kind == 1 and S[0][i] == S[0][i+1]:
          ans *= 3
          last_kind = 1
          i += 
      ans %= M
  
  print(ans)
  
problem_description: Statement
  
  We have a board with a 2 \times N grid. Snuke covered the board with N
  dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1
  square.
  
  Then, Snuke decided to paint these dominoes using three colors: red, cyan and
  green. Two dominoes that are adjacent by side should be painted by different
  colors. Here, it is not always necessary to use all three colors.
  
  Find the number of such ways to paint the dominoes, modulo 1000000007.
  
  The arrangement of the dominoes is given to you as two strings S_1 and S_2 in
  the following manner:
  
    * Each domino is represented by a different English letter (lowercase or uppercase).
    * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left.
samples: [{"input": "3\n    aab\n    ccb", "output": "6\n    \n\nThere are six ways as shown below:\n\n![](https://atcoder.jp/img/arc081/899673bd23529f4fb5e41c6e7d5bc372.png)\n\n* * *"}, {"input": "1\n    Z\n    Z", "output": "3\n    \n\nNote that it is not always necessary to use all the colors.\n\n* * *"}, {"input": "52\n    RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\n    RLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn", "output": "958681902"}]