public static int calMin ( int a , int b , int c , int [ ] l , int i , int cost ) {
  if ( i == l . length ) {
    if ( a == 0 || b == 0 || c == 0 ) {
      return Integer . MAX_VALUE ;
    }
    else {
      return cost + Math . abs ( A - a ) + Math . abs ( B - b ) + Math . abs ( C - c ) - 30 ;
    }
  }
  return Math . min ( Math . min ( calMin ( a + l [ i ] , b , c , l , i + 1 , cost + 10 ) , calMin ( a , b + l [ i ] , c , l , i + 1 , cost + 10 ) ) , Math . min ( calMin ( a , b , c + l [ i ] , l , i + 1 , cost + 10 ) , calMin ( a , b , c , l , i + 1 , cost ) ) ) ;
}

public static int calMin ( int a , int b , int c , int [ ] l , int i , int cost ) { if ( i == l . length ) { if ( a == 0 || b == 0 || c == 0 ) { return Integer . MAX_VALUE ; } else { return cost + Math . abs ( A - a ) + Math . abs ( B - b ) + Math . abs ( C - c ) - 30 ; } } return Math . min ( Math . min ( calMin ( a + l [ i ] , b , c , l , i + 1 , cost + 10 ) , calMin ( a , b + l [ i ] , c , l , i + 1 , cost + 10 ) ) , Math . min ( calMin ( a , b , c + l [ i ] , l , i + 1 , cost + 10 ) , calMin ( a , b , c , l , i + 1 , cost ) ) ) ; }
(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)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) 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: (identifier) right: (field_access object: (identifier) field: (identifier)))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (return_statement (field_access object: (identifier) field: (identifier)))) alternative: (block (return_statement (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) right: (decimal_integer_literal))))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) (identifier) (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (decimal_integer_literal)))) (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (decimal_integer_literal)))) (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier))))))))))