






"""simple docstring"""





class 					a						:






    def __init__(	self					:							Dict )					->		None:
      # numbermap keys are the number and its values are lists of indexes sorted
      # in ascending order
      lowerCamelCase_   					=						{}
      # indexmap keys are an index and it's values are the number at that index
      lowerCamelCase_   					=						{}






    def        UpperCamelCase	(	self					:							Any	,						__SCREAMING_SNAKE_CASE					:							list | str | range	,						__SCREAMING_SNAKE_CASE					:							int )					->		list[int]:
      if isinstance(__SCREAMING_SNAKE_CASE	,						(range, str) ):
        lowerCamelCase_   					=						list(__SCREAMING_SNAKE_CASE )
      elif not isinstance(__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE ):
        raise TypeError(
            'binary_search_delete() only accepts either a list, range or str' )

      lowerCamelCase_   					=						0
      lowerCamelCase_   					=						len(__SCREAMING_SNAKE_CASE ) - 1

      while low <= high:
        lowerCamelCase_   					=						(low + high) // 2
        if array[mid] == item:
          array.pop(__SCREAMING_SNAKE_CASE )
          return array
        elif array[mid] < item:
          lowerCamelCase_   					=						mid + 1
        else:
          lowerCamelCase_   					=						mid - 1
      raise ValueError(
          'Either the item is not in the array or the array was unsorted' )






    def        UpperCamelCase	(	self					:							Tuple	,						__SCREAMING_SNAKE_CASE					:							list | str | range	,						__SCREAMING_SNAKE_CASE					:							int )					->		list[int]:
      if isinstance(__SCREAMING_SNAKE_CASE	,						(range, str) ):
        lowerCamelCase_   					=						list(__SCREAMING_SNAKE_CASE )
      elif not isinstance(__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE ):
        raise TypeError(
            'binary_search_insert() only accepts either a list, range or str' )

      lowerCamelCase_   					=						0
      lowerCamelCase_   					=						len(__SCREAMING_SNAKE_CASE ) - 1

      while low <= high:
        lowerCamelCase_   					=						(low + high) // 2
        if array[mid] == index:
          # If the item already exists in the array,
          # insert it after the existing item
          array.insert(mid + 1	,						__SCREAMING_SNAKE_CASE )
          return array
        elif array[mid] < index:
          lowerCamelCase_   					=						mid + 1
        else:
          lowerCamelCase_   					=						mid - 1

        # If the item doesn't exist in the array, insert it at the appropriate position
      array.insert(__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE )
      return array






    def        UpperCamelCase	(	self					:							str	,						__SCREAMING_SNAKE_CASE					:							int	,						__SCREAMING_SNAKE_CASE					:							int )					->		None:
      # Remove previous index
      if index in self.indexmap:
        lowerCamelCase_   					=						self.indexmap[index]
        if len(self.numbermap[n] ) == 1:
          del self.numbermap[n]
        else:
          lowerCamelCase_   					=						self.binary_search_delete(self.numbermap[n]	,						__SCREAMING_SNAKE_CASE )

        # Set new index
      lowerCamelCase_   					=						number

      # Number not seen before or empty so insert number value
      if number not in self.numbermap:
        lowerCamelCase_   					=						[index]

      # Here we need to perform a binary search insertion in order to insert
      # The item in the correct place
      else:
        lowerCamelCase_   					=						self.binary_search_insert(
            self.numbermap[number]	,						__SCREAMING_SNAKE_CASE )






    def        UpperCamelCase	(	self					:							List[str]	,						__SCREAMING_SNAKE_CASE					:							int )					->		int:
      return self.numbermap.get(__SCREAMING_SNAKE_CASE	,						[-1] )[0]


if __name__ == "__main__":
  import doctest

  doctest.testmod()












"""simple docstring"""





def 					lowerCamelCase__	(							_lowerCamelCase	:		int = 1000			)				->    int:
  lowerCamelCase_   					=						0
  lowerCamelCase_   					=						(n - 1) // 3
  total += ((terms) * (6 + (terms - 1) * 3)) // 2  # total of an A.P.
  lowerCamelCase_   					=						(n - 1) // 5
  total += ((terms) * (10 + (terms - 1) * 5)) // 2
  lowerCamelCase_   					=						(n - 1) // 15
  total -= ((terms) * (30 + (terms - 1) * 15)) // 2
  return total


if __name__ == "__main__":
  print(F'''{solution() = }''')




