


def lowerCamelCase__      (						__lowerCamelCase	:							List[str]	,   __lowerCamelCase	:							Union[str, Any]							):







   '''simple docstring'''




   _UpperCAmelCase       :       Optional[int]							   =0
   _UpperCAmelCase       :       Any							   =len(lowerCAmelCase__							) - 1

   while left <= right:
      # avoid divided by 0 during interpolation
      if sorted_collection[left] == sorted_collection[right]:
         if sorted_collection[left] == item:
            return left
         else:
            return None

      _UpperCAmelCase       :       List[str]							   =left + ((item - sorted_collection[left]) * (right - left)) // (
          sorted_collection[right] - sorted_collection[left]
      )

      # out of range check
      if point < 0 or point >= len(lowerCAmelCase__							):
         return None

      _UpperCAmelCase       :       Dict							   =sorted_collection[point]
      if current_item == item:
         return point
      else:
         if point < left:
            _UpperCAmelCase       :       Optional[int]							   =left
            _UpperCAmelCase       :       Optional[Any]							   =point
         elif point > right:
            _UpperCAmelCase       :       Union[str, Any]							   =right
            _UpperCAmelCase       :       Optional[Any]							   =point
         else:
            if item < current_item:
               _UpperCAmelCase       :       Optional[Any]							   =point - 1
            else:
               _UpperCAmelCase       :       Optional[int]							   =point + 1
   return None





def lowerCamelCase__      (						__lowerCamelCase	:							List[Any]	,   __lowerCamelCase	:							Optional[int]	,   __lowerCamelCase	:							Optional[Any]	,   __lowerCamelCase	:							Optional[Any]							):







   '''simple docstring'''




   if sorted_collection[left] == sorted_collection[right]:
      if sorted_collection[left] == item:
         return left
      else:
         return None

   _UpperCAmelCase       :       Any							   =left + ((item - sorted_collection[left]) * (right - left)) // (
       sorted_collection[right] - sorted_collection[left]
   )

   # out of range check
   if point < 0 or point >= len(lowerCAmelCase__							):
      return None

   if sorted_collection[point] == item:
      return point
   elif point < left:
      return interpolation_search_by_recursion(lowerCAmelCase__	,   lowerCAmelCase__	,   lowerCAmelCase__	,   lowerCAmelCase__							)
   elif point > right:
      return interpolation_search_by_recursion(lowerCAmelCase__	,   lowerCAmelCase__	,   lowerCAmelCase__	,   lowerCAmelCase__							)
   else:
      if sorted_collection[point] > item:
         return interpolation_search_by_recursion(
             lowerCAmelCase__	,   lowerCAmelCase__	,   lowerCAmelCase__	,   point - 1							)
      else:
         return interpolation_search_by_recursion(
             lowerCAmelCase__	,   lowerCAmelCase__	,   point + 1	,   lowerCAmelCase__							)





def lowerCamelCase__      (						__lowerCamelCase	:							Dict							):







   '''simple docstring'''




   if collection != sorted(lowerCAmelCase__							):
      raise ValueError('Collection must be ascending sorted'							)
   return True


if __name__ == "__main__":
 import sys
 lowercase							=0
 if debug == 1:
  lowercase							=[10, 30, 40, 45, 50, 66, 77, 93]
  try:
   __assert_sorted(collection)
  except ValueError:
   sys.exit('Sequence must be ascending sorted to apply interpolation search')
  lowercase							=67

 lowercase							=interpolation_search(collection, target)
 if result is not None:
  print(F"""{target} found at positions: {result}""")
 else:
  print('Not found')





'''simple docstring'''






from __future__ import annotations

import bisect





def lowerCamelCase__      (						__lowerCamelCase	:							list[int]	,   __lowerCamelCase	:							int	,   __lowerCamelCase	:							int = 0	,   __lowerCamelCase	:							int = -1							):







   '''simple docstring'''




   if hi < 0:
      _UpperCAmelCase       :       int							   =len(__lowerCamelCase							)

   while lo < hi:
      _UpperCAmelCase       :       Dict							   =lo + (hi - lo) // 2
      if sorted_collection[mid] < item:
         _UpperCAmelCase       :       int							   =mid + 1
      else:
         _UpperCAmelCase       :       Union[str, Any]							   =mid

   return lo





def lowerCamelCase__      (						__lowerCamelCase	:							list[int]	,   __lowerCamelCase	:							int	,   __lowerCamelCase	:							int = 0	,   __lowerCamelCase	:							int = -1							):







   '''simple docstring'''




   if hi < 0:
      _UpperCAmelCase       :       str							   =len(__lowerCamelCase							)

   while lo < hi:
      _UpperCAmelCase       :       List[Any]							   =lo + (hi - lo) // 2
      if sorted_collection[mid] <= item:
         _UpperCAmelCase       :       Dict							   =mid + 1
      else:
         _UpperCAmelCase       :       Tuple							   =mid

   return lo





def lowerCamelCase__      (						__lowerCamelCase	:							list[int]	,   __lowerCamelCase	:							int	,   __lowerCamelCase	:							int = 0	,   __lowerCamelCase	:							int = -1							):







   '''simple docstring'''




   sorted_collection.insert(bisect_left(__lowerCamelCase	,   __lowerCamelCase	,   __lowerCamelCase	,   __lowerCamelCase							)	,   __lowerCamelCase							)





def lowerCamelCase__      (						__lowerCamelCase	:							list[int]	,   __lowerCamelCase	:							int	,   __lowerCamelCase	:							int = 0	,   __lowerCamelCase	:							int = -1							):







   '''simple docstring'''




   sorted_collection.insert(bisect_right(__lowerCamelCase	,   __lowerCamelCase	,   __lowerCamelCase	,   __lowerCamelCase							)	,   __lowerCamelCase							)





def lowerCamelCase__      (						__lowerCamelCase	:							list[int]	,   __lowerCamelCase	:							int							):







   '''simple docstring'''




   _UpperCAmelCase       :       Optional[int]							   =0
   _UpperCAmelCase       :       Any							   =len(__lowerCamelCase							) - 1

   while left <= right:
      _UpperCAmelCase       :       int							   =left + (right - left) // 2
      _UpperCAmelCase       :       Union[str, Any]							   =sorted_collection[midpoint]
      if current_item == item:
         return midpoint
      elif item < current_item:
         _UpperCAmelCase       :       Optional[Any]							   =midpoint - 1
      else:
         _UpperCAmelCase       :       int							   =midpoint + 1
   return None





def lowerCamelCase__      (						__lowerCamelCase	:							list[int]	,   __lowerCamelCase	:							int							):







   '''simple docstring'''




   _UpperCAmelCase       :       Any							   =bisect.bisect_left(__lowerCamelCase	,   __lowerCamelCase							)
   if index != len(__lowerCamelCase							) and sorted_collection[index] == item:
      return index
   return None





def lowerCamelCase__      (						__lowerCamelCase	:							list[int]	,   __lowerCamelCase	:							int	,   __lowerCamelCase	:							int	,   __lowerCamelCase	:							int							):







   '''simple docstring'''




   if right < left:
      return None

   _UpperCAmelCase       :       str							   =left + (right - left) // 2

   if sorted_collection[midpoint] == item:
      return midpoint
   elif sorted_collection[midpoint] > item:
      return binary_search_by_recursion(__lowerCamelCase	,   __lowerCamelCase	,   __lowerCamelCase	,   midpoint - 1							)
   else:
      return binary_search_by_recursion(__lowerCamelCase	,   __lowerCamelCase	,   midpoint + 1	,   __lowerCamelCase							)


if __name__ == "__main__":
 lowercase							=input('Enter numbers separated by comma:\n').strip()
 lowercase							=sorted(int(item) for item in user_input.split(','))
 lowercase							=int(input('Enter a single number to be found in the list:\n'))
 lowercase							=binary_search(collection, target)
 if result is None:
  print(F"""{target} was not found in {collection}.""")
 else:
  print(F"""{target} was found at position {result} in {collection}.""")

