static int calmp ( int n , int a , int b , int c ) {
  if ( n == N ) {
    return ( min ( min ( a , b ) , c ) > 0 ) ? ( abs ( A - a ) + abs ( B - b ) + abs ( C - c ) - 30 ) : 3000 ;
  }
  int mp0 = calmp ( n + 1 , a , b , c ) ;
  int mp1 = calmp ( n + 1 , a + L [ n ] , b , c ) + 10 ;
  int mp2 = calmp ( n + 1 , a , b + L [ n ] , c ) + 10 ;
  int mp3 = calmp ( n + 1 , a , b , c + L [ n ] ) + 10 ;
  return min ( min ( mp0 , mp1 ) , min ( mp2 , mp3 ) ) ;
}

static int calmp ( int n , int a , int b , int c ) { if ( n == N ) { return ( min ( min ( a , b ) , c ) > 0 ) ? ( abs ( A - a ) + abs ( B - b ) + abs ( C - c ) - 30 ) : 3000 ; } int mp0 = calmp ( n + 1 , a , b , c ) ; int mp1 = calmp ( n + 1 , a + L [ n ] , b , c ) + 10 ; int mp2 = calmp ( n + 1 , a , b + L [ n ] , c ) + 10 ; int mp3 = calmp ( n + 1 , a , b , c + L [ n ] ) + 10 ; return min ( min ( mp0 , mp1 ) , min ( mp2 , mp3 ) ) ; }
(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 (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (return_statement (ternary_expression condition: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))) (identifier))) right: (decimal_integer_literal))) consequence: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) right: (decimal_integer_literal))) alternative: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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 name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))) (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))))))