public static void main ( String args [ ] ) {
  Scanner sc = new Scanner ( System . in ) ;
  int x = sc . nextInt ( ) ;
  int y = sc . nextInt ( ) ;
  int a = sc . nextInt ( ) ;
  int b = sc . nextInt ( ) ;
  Map < Pair , Integer > map = new LinkedHashMap < > ( ) ;
  int sv = 0 , sp = 0 , ev = 0 , ep = 0 ;
  if ( a > b ) {
    sv = a ;
    ev = x ;
    sp = b ;
    ep = y ;
  }
  else {
    sv = b + 1 ;
    ev = x ;
    sp = b ;
    ep = y ;
  }
  int count = 0 ;
  for ( int i = sv ;
  i <= ev ;
  i ++ ) {
    for ( int j = sp ;
    j <= ep ;
    j ++ ) {
      if ( j >= i ) break ;
      Pair p = new Pair ( i , j ) ;
      map . put ( p , count ++ ) ;
    }
  }
  System . out . println ( count ) ;
  map . forEach ( ( k , v ) -> System . out . println ( k . getKey ( ) + " " + k . getValue ( ) ) ) ;
}

public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; Map < Pair , Integer > map = new LinkedHashMap < > ( ) ; int sv = 0 , sp = 0 , ev = 0 , ep = 0 ; if ( a > b ) { sv = a ; ev = x ; sp = b ; ep = y ; } else { sv = b + 1 ; ev = x ; sp = b ; ep = y ; } int count = 0 ; for ( int i = sv ; i <= ev ; i ++ ) { for ( int j = sp ; j <= ep ; j ++ ) { if ( j >= i ) break ; Pair p = new Pair ( i , j ) ; map . put ( p , count ++ ) ; } } System . out . println ( count ) ; map . forEach ( ( k , v ) -> System . out . println ( k . getKey ( ) + " ▁ " + k . getValue ( ) ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) 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: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) 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)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (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: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (update_expression (identifier))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (lambda_expression parameters: (inferred_parameters (identifier) (identifier)) body: (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (string_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))))))