static long go ( int [ ] a , int [ ] b ) {
  long sum = 0 ;
  for ( int x : b ) sum += x ;
  long res = 0 ;
  int max = 0 ;
  for ( int i = 0 ;
  i < a . length ;
  i ++ ) {
    max = Math . max ( max , a [ i ] ) ;
    res += Math . min ( a [ i ] , sum ) ;
  }
  return res + sum - Math . min ( max , sum ) ;
}

static long go ( int [ ] a , int [ ] b ) { long sum = 0 ; for ( int x : b ) sum += x ; long res = 0 ; int max = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { max = Math . max ( max , a [ i ] ) ; res += Math . min ( a [ i ] , sum ) ; } return res + sum - Math . min ( max , sum ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (expression_statement (assignment_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (identifier))))))) (return_statement (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))))