public static void solve ( long n , long m ) {
  long count = 0 , temp ;
  if ( m % n == 0 ) {
    temp = m / n ;
    while ( temp % 2 == 0 ) {
      count ++ ;
      temp /= 2 ;
    }
    while ( temp % 3 == 0 ) {
      count ++ ;
      temp /= 3 ;
    }
    if ( temp == 1 ) {
      System . out . println ( count ) ;
    }
    else {
      System . out . println ( - 1 ) ;
    }
  }
  else {
    System . out . println ( - 1 ) ;
  }
}

public static void solve ( long n , long m ) { long count = 0 , temp ; if ( m % n == 0 ) { temp = m / n ; while ( temp % 2 == 0 ) { count ++ ; temp /= 2 ; } while ( temp % 3 == 0 ) { count ++ ; temp /= 3 ; } if ( temp == 1 ) { System . out . println ( count ) ; } else { System . out . println ( - 1 ) ; } } else { System . out . println ( - 1 ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) body: (block (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) body: (block (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal)))))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal)))))))))