private static Consumer < List < String >> solve ( ) {
  return args -> {
    final char [ ] first = args . get ( 1 ) . toCharArray ( ) ;
    final char [ ] second = args . get ( 2 ) . toCharArray ( ) ;
    Long ans = 1L ;
    Boolean isPrevVertical = null ;
    Integer index = 0 ;
    while ( index < first . length ) {
      if ( first [ index ] == second [ index ] ) {
        if ( isPrevVertical == null ) {
          ans = ( ans * 3 ) % 1000000007 ;
        }
        else if ( isPrevVertical ) {
          ans = ( ans * 2 ) % 1000000007 ;
        }
        isPrevVertical = true ;
        index ++ ;
      }
      else {
        if ( isPrevVertical == null ) {
          ans = ( ans * 6 ) % 1000000007 ;
        }
        else if ( isPrevVertical ) {
          ans = ( ans * 2 ) % 1000000007 ;
        }
        else {
          ans = ( ans * 3 ) % 1000000007 ;
        }
        isPrevVertical = false ;
        index += 2 ;
      }
    }
    System . out . println ( ans ) ;
  };
}

private static Consumer < List < String > > solve ( ) { return args -> { final char [ ] first = args . get ( 1 ) . toCharArray ( ) ; final char [ ] second = args . get ( 2 ) . toCharArray ( ) ; Long ans = 1L ; Boolean isPrevVertical = null ; Integer index = 0 ; while ( index < first . length ) { if ( first [ index ] == second [ index ] ) { if ( isPrevVertical == null ) { ans = ( ans * 3 ) % 1000000007 ; } else if ( isPrevVertical ) { ans = ( ans * 2 ) % 1000000007 ; } isPrevVertical = true ; index ++ ; } else { if ( isPrevVertical == null ) { ans = ( ans * 6 ) % 1000000007 ; } else if ( isPrevVertical ) { ans = ( ans * 2 ) % 1000000007 ; } else { ans = ( ans * 3 ) % 1000000007 ; } isPrevVertical = false ; index += 2 ; } } System . out . println ( ans ) ; } ; }
(method_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (generic_type (type_identifier) (type_arguments (type_identifier))))) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (lambda_expression parameters: (identifier) body: (block (local_variable_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) name: (identifier) arguments: (argument_list)))) (local_variable_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (null_literal))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier)))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) alternative: (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (true))) (expression_statement (update_expression (identifier)))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) alternative: (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (false))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))))))