public static void main ( String args [ ] ) {
  a = new int [ 1000001 ] ;
  a [ 1 ] = 2 ;
  a [ 2 ] = 4 ;
  for ( int i = 3 ;
  i <= 1000000 ;
  ++ i ) a [ i ] = find ( i - 1 , i ) + i ;
  Scanner scanner = new Scanner ( System . in ) ;
  int caseNumber = scanner . nextInt ( ) ;
  for ( int cases = 0 ;
  cases < caseNumber ;
  ++ cases ) {
    int a1 = scanner . nextInt ( ) ;
    int a2 = scanner . nextInt ( ) ;
    int b1 = scanner . nextInt ( ) ;
    int b2 = scanner . nextInt ( ) ;
    BigInteger ans = new BigInteger ( "0" ) ;
    for ( int i = a1 ;
    i <= a2 ;
    ++ i ) {
      int up = b2 ;
      int low = a [ i ] ;
      if ( b1 > low ) low = b1 ;
      if ( low > up ) continue ;
      ans = ans . add ( new BigInteger ( Integer . toString ( up - low + 1 ) ) ) ;
    }
    for ( int i = b1 ;
    i <= b2 ;
    ++ i ) {
      int up = a2 ;
      int low = a [ i ] ;
      if ( a1 > low ) low = a1 ;
      if ( low > up ) continue ;
      ans = ans . add ( new BigInteger ( Integer . toString ( up - low + 1 ) ) ) ;
    }
    System . out . println ( "Case #" + ( cases + 1 ) + ": " + ans ) ;
  }
}

public static void main ( String args [ ] ) { a = new int [ 1000001 ] ; a [ 1 ] = 2 ; a [ 2 ] = 4 ; for ( int i = 3 ; i <= 1000000 ; ++ i ) a [ i ] = find ( i - 1 , i ) + i ; Scanner scanner = new Scanner ( System . in ) ; int caseNumber = scanner . nextInt ( ) ; for ( int cases = 0 ; cases < caseNumber ; ++ cases ) { int a1 = scanner . nextInt ( ) ; int a2 = scanner . nextInt ( ) ; int b1 = scanner . nextInt ( ) ; int b2 = scanner . nextInt ( ) ; BigInteger ans = new BigInteger ( "0" ) ; for ( int i = a1 ; i <= a2 ; ++ i ) { int up = b2 ; int low = a [ i ] ; if ( b1 > low ) low = b1 ; if ( low > up ) continue ; ans = ans . add ( new BigInteger ( Integer . toString ( up - low + 1 ) ) ) ; } for ( int i = b1 ; i <= b2 ; ++ i ) { int up = a2 ; int low = a [ i ] ; if ( a1 > low ) low = a1 ; if ( low > up ) continue ; ans = ans . add ( new BigInteger ( Integer . toString ( up - low + 1 ) ) ) ; } System . out . println ( " Case ▁ # " + ( cases + 1 ) + " : ▁ " + ans ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier))) right: (identifier))))) (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)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (string_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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (string_literal) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (string_literal)) right: (identifier)))))))))