






'''simple docstring'''
from decimal import Decimal, getcontext
from math import ceil, factorial





def  _a(  UpperCamelCase__				:						int							):




      '''simple docstring'''






      if not isinstance(UpperCamelCase__,	UpperCamelCase__							):
            raise TypeError('''Undefined for non-integers'''							)
      elif precision < 1:
            raise ValueError('''Undefined for non-natural numbers'''							)

      SCREAMING_SNAKE_CASE__     :				Any									=precision
      SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=ceil(precision / 1_4							)
      SCREAMING_SNAKE_CASE__     :				Optional[int]									=4_2_6_8_8_0 * Decimal(1_0_0_0_5							).sqrt()
      SCREAMING_SNAKE_CASE__     :				str									=1
      SCREAMING_SNAKE_CASE__     :				int									=1_3_5_9_1_4_0_9
      SCREAMING_SNAKE_CASE__     :				Any									=Decimal(UpperCamelCase__							)
      for k in range(1,	UpperCamelCase__							):
            SCREAMING_SNAKE_CASE__     :				Optional[Any]									=factorial(6 * k							) // (factorial(3 * k							) * factorial(UpperCamelCase__							) ** 3)
            linear_term += 5_4_5_1_4_0_1_3_4
            exponential_term *= -2_6_2_5_3_7_4_1_2_6_4_0_7_6_8_0_0_0
            partial_sum += Decimal(multinomial_term * linear_term							) / exponential_term
      return str(constant_term / partial_sum							)[:-1]


if __name__ == "__main__":
  a_					= 5_0
  print(F'''The first {n} digits of pi is: {pi(n)}''')







'''simple docstring'''
def  _a(  UpperCamelCase__				:						Optional[int],	UpperCamelCase__				:						int							):




      '''simple docstring'''






      SCREAMING_SNAKE_CASE__     :				Optional[int]									=0
      SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=len(UpperCamelCase__							) - 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

            SCREAMING_SNAKE_CASE__     :				Union[str, Any]									=left + ((item - sorted_collection[left]) * (right - left)) // (
                sorted_collection[right] - sorted_collection[left]
            )

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

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





def  _a(  UpperCamelCase__				:						List[str],	UpperCamelCase__				:						Optional[Any],	UpperCamelCase__				:						Union[str, Any],	UpperCamelCase__				:						Union[str, Any]							):




      '''simple docstring'''






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

      SCREAMING_SNAKE_CASE__     :				Dict									=left + ((item - sorted_collection[left]) * (right - left)) // (
          sorted_collection[right] - sorted_collection[left]
      )

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

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





def  _a(  UpperCamelCase__				:						Dict							):




      '''simple docstring'''






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


if __name__ == "__main__":
  import sys
  a_					= 0
  if debug == 1:
    a_					= [1_0, 3_0, 4_0, 4_5, 5_0, 6_6, 7_7, 9_3]
    try:
      __assert_sorted(collection)
    except ValueError:
      sys.exit('Sequence must be ascending sorted to apply interpolation search')
    a_					= 6_7

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