private static int dfs ( int cur , int a0 , int b0 , int c0 ) {
  if ( cur == n ) return ( Math . min ( Math . min ( a0 , b0 ) , c0 ) > 0 ? Math . abs ( a0 - a ) + Math . abs ( b0 - b ) + Math . abs ( c0 - c ) - 30 : 1000000000 ) ;
  int ret0 = dfs ( cur + 1 , a0 , b0 , c0 ) ;
  int ret1 = dfs ( cur + 1 , a0 + l [ cur ] , b0 , c0 ) + 10 ;
  int ret2 = dfs ( cur + 1 , a0 , b0 + l [ cur ] , c0 ) + 10 ;
  int ret3 = dfs ( cur + 1 , a0 , b0 , c0 + l [ cur ] ) + 10 ;
  return Math . min ( Math . min ( Math . min ( ret0 , ret1 ) , ret2 ) , ret3 ) ;
}

private static int dfs ( int cur , int a0 , int b0 , int c0 ) { if ( cur == n ) return ( Math . min ( Math . min ( a0 , b0 ) , c0 ) > 0 ? Math . abs ( a0 - a ) + Math . abs ( b0 - b ) + Math . abs ( c0 - c ) - 30 : 1000000000 ) ; int ret0 = dfs ( cur + 1 , a0 , b0 , c0 ) ; int ret1 = dfs ( cur + 1 , a0 + l [ cur ] , b0 , c0 ) + 10 ; int ret2 = dfs ( cur + 1 , a0 , b0 + l [ cur ] , c0 ) + 10 ; int ret3 = dfs ( cur + 1 , a0 , b0 , c0 + l [ cur ] ) + 10 ; return Math . min ( Math . min ( Math . min ( ret0 , ret1 ) , ret2 ) , ret3 ) ; }
(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: (return_statement (parenthesized_expression (ternary_expression condition: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))) (identifier))) right: (decimal_integer_literal)) consequence: (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: (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 object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))) (identifier))) (identifier))))))