static int cost ( int depth , int a , int b , int c ) {
  int INF = ( int ) 10e8 ;
  int pattern0 , pattern1 , pattern2 , pattern3 ;
  if ( depth == N ) {
    if ( a > 0 && b > 0 && c > 0 ) {
      return Math . abs ( a - A ) + Math . abs ( b - B ) + Math . abs ( c - C ) - 30 ;
    }
    else {
      return INF ;
    }
  }
  pattern0 = cost ( depth + 1 , a , b , c ) ;
  pattern1 = cost ( depth + 1 , a + l [ depth ] , b , c ) + 10 ;
  pattern2 = cost ( depth + 1 , a , b + l [ depth ] , c ) + 10 ;
  pattern3 = cost ( depth + 1 , a , b , c + l [ depth ] ) + 10 ;
  return Math . min ( Math . min ( pattern0 , pattern1 ) , Math . min ( pattern2 , pattern3 ) ) ;
}

static int cost ( int depth , int a , int b , int c ) { int INF = ( int ) 10e8 ; int pattern0 , pattern1 , pattern2 , pattern3 ; if ( depth == N ) { if ( a > 0 && b > 0 && c > 0 ) { return Math . abs ( a - A ) + Math . abs ( b - B ) + Math . abs ( c - C ) - 30 ; } else { return INF ; } } pattern0 = cost ( depth + 1 , a , b , c ) ; pattern1 = cost ( depth + 1 , a + l [ depth ] , b , c ) + 10 ; pattern2 = cost ( depth + 1 , a , b + l [ depth ] , c ) + 10 ; pattern3 = cost ( depth + 1 , a , b , c + l [ depth ] ) + 10 ; return Math . min ( Math . min ( pattern0 , pattern1 ) , Math . min ( pattern2 , pattern3 ) ) ; }
(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: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (decimal_floating_point_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (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 (binary_expression left: (binary_expression left: (binary_expression left: (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)))) alternative: (block (return_statement (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) (identifier) (identifier))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) (identifier))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (binary_expression left: (identifier) right: (array_access array: (identifier) index: (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 (identifier) (identifier))) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))))