public static void main ( String [ ] args ) {
  SC sc = new SC ( System . in ) ;
  long I = sc . nextLong ( ) ;
  long O = sc . nextLong ( ) ;
  long T = sc . nextLong ( ) ;
  long J = sc . nextLong ( ) ;
  long L = sc . nextLong ( ) ;
  long S = sc . nextLong ( ) ;
  long Z = sc . nextLong ( ) ;
  long ans = 0 ;
  long tmp = 0 ;
  if ( I > 0 ) {
    ans += ( ( I - 1 ) / 2 ) * 2 ;
  }
  ans += O ;
  if ( J > 0 ) {
    ans += ( ( J - 1 ) / 2 ) * 2 ;
  }
  if ( L > 0 ) {
    ans += ( ( L - 1 ) / 2 ) * 2 ;
  }
  if ( I > 0 && J > 0 && L > 0 ) {
    ans += 3 ;
  }
  tmp += I / 2 * 2 ;
  tmp += O ;
  tmp += J / 2 * 2 ;
  tmp += L / 2 * 2 ;
  pl ( Math . max ( ans , tmp ) ) ;
}

public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; long I = sc . nextLong ( ) ; long O = sc . nextLong ( ) ; long T = sc . nextLong ( ) ; long J = sc . nextLong ( ) ; long L = sc . nextLong ( ) ; long S = sc . nextLong ( ) ; long Z = sc . nextLong ( ) ; long ans = 0 ; long tmp = 0 ; if ( I > 0 ) { ans += ( ( I - 1 ) / 2 ) * 2 ; } ans += O ; if ( J > 0 ) { ans += ( ( J - 1 ) / 2 ) * 2 ; } if ( L > 0 ) { ans += ( ( L - 1 ) / 2 ) * 2 ; } if ( I > 0 && J > 0 && L > 0 ) { ans += 3 ; } tmp += I / 2 * 2 ; tmp += O ; tmp += J / 2 * 2 ; tmp += L / 2 * 2 ; pl ( Math . max ( ans , tmp ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) right: (decimal_integer_literal)))))) (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 (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))))