public static long solve ( long n , long a , long b ) {
  if ( n % 2 == 0 ) {
    long ans1 = n * a ;
    long ans2 = ( n / 2 ) * b ;
    return Math . min ( ans2 , ans1 ) ;
  }
  else {
    long ans1 = ( n - 1 ) * a ;
    long ans2 = ( ( n - 1 ) / 2 ) * b ;
    return Math . min ( ans2 , ans1 ) + a ;
  }
}

public static long solve ( long n , long a , long b ) { if ( n % 2 == 0 ) { long ans1 = n * a ; long ans2 = ( n / 2 ) * b ; return Math . min ( ans2 , ans1 ) ; } else { long ans1 = ( n - 1 ) * a ; long ans2 = ( ( n - 1 ) / 2 ) * b ; return Math . min ( ans2 , ans1 ) + a ; } }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) right: (identifier)))) (return_statement (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))) right: (identifier)))))))