public static void main ( String [ ] args ) {
  Scanner scan = new Scanner ( System . in ) ;
  int n , m , i , j , k , l , a , b , sum = 0 , min = 0 , x = 0 ;
  int [ ] [ ] garden = new int [ 50 ] [ 50 ] ;
  n = scan . nextInt ( ) ;
  m = scan . nextInt ( ) ;
  for ( i = 0 ;
  i < n ;
  ++ i ) for ( j = 0 ;
  j < m ;
  ++ j ) garden [ i ] [ j ] = scan . nextInt ( ) ;
  a = scan . nextInt ( ) ;
  b = scan . nextInt ( ) ;
  for ( i = 0 ;
  i + a - 1 < n ;
  ++ i ) for ( j = 0 ;
  j + b - 1 < m ;
  ++ j ) {
    sum = 0 ;
    for ( l = i ;
    l <= i + a - 1 ;
    ++ l ) for ( k = j ;
    k <= j + b - 1 ;
    ++ k ) if ( garden [ l ] [ k ] == 1 ) ++ sum ;
    if ( x == 0 ) {
      min = sum ;
      ++ x ;
    }
    else if ( sum < min ) min = sum ;
  }
  for ( i = 0 ;
  i + b - 1 < n ;
  ++ i ) for ( j = 0 ;
  j + a - 1 < m ;
  ++ j ) {
    sum = 0 ;
    for ( l = i ;
    l <= i + b - 1 ;
    ++ l ) for ( k = j ;
    k <= j + a - 1 ;
    ++ k ) if ( garden [ l ] [ k ] == 1 ) ++ sum ;
    if ( x == 0 ) {
      min = sum ;
      ++ x ;
    }
    else if ( sum < min ) min = sum ;
  }
  System . out . println ( min ) ;
}

public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n , m , i , j , k , l , a , b , sum = 0 , min = 0 , x = 0 ; int [ ] [ ] garden = new int [ 50 ] [ 50 ] ; n = scan . nextInt ( ) ; m = scan . nextInt ( ) ; for ( i = 0 ; i < n ; ++ i ) for ( j = 0 ; j < m ; ++ j ) garden [ i ] [ j ] = scan . nextInt ( ) ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; for ( i = 0 ; i + a - 1 < n ; ++ i ) for ( j = 0 ; j + b - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + a - 1 ; ++ l ) for ( k = j ; k <= j + b - 1 ; ++ k ) if ( garden [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } for ( i = 0 ; i + b - 1 < n ; ++ i ) for ( j = 0 ; j + a - 1 < m ; ++ j ) { sum = 0 ; for ( l = i ; l <= i + b - 1 ; ++ l ) for ( k = j ; k <= j + a - 1 ; ++ k ) if ( garden [ l ] [ k ] == 1 ) ++ sum ; if ( x == 0 ) { min = sum ; ++ x ; } else if ( sum < min ) min = sum ; } System . out . println ( min ) ; }
(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)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal)) dimensions: (dimensions_expr (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (identifier)) update: (update_expression (identifier)) body: (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (for_statement init: (assignment_expression left: (identifier) right: (identifier)) condition: (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (for_statement init: (assignment_expression left: (identifier) right: (identifier)) condition: (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier)))))))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (identifier)) update: (update_expression (identifier)) body: (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (for_statement init: (assignment_expression left: (identifier) right: (identifier)) condition: (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (for_statement init: (assignment_expression left: (identifier) right: (identifier)) condition: (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))