

from decimal import Decimal, getcontext
from math import ceil, factorial



def   __UpperCAmelCase					(      __a :     int      )     ->	str:

					"""simple docstring"""

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

					_a      :       Union[str, Any]   =						precision
					_a      :       str   =						ceil(precision / 14      )
					_a      :       Dict   =						426_880 * Decimal(10_005      ).sqrt()
					_a      :       Optional[Any]   =						1
					_a      :       Optional[Any]   =						13_591_409
					_a      :       List[Any]   =						Decimal(__a      )
					for k in range(1						,__a      ):
										_a      :       Optional[Any]   =						factorial(6 * k      ) // (factorial(3 * k      ) * factorial(__a      ) ** 3)
										linear_term += 545_140_134
										exponential_term *= -262_537_412_640_768_000
										partial_sum += Decimal(multinomial_term * linear_term      ) / exponential_term
					return str(constant_term / partial_sum      )[:-1]


if __name__ == "__main__":
			a__												=						50
			print(f'''The first {n} digits of pi is: {pi(n)}''')






from PIL import Image







def 						lowerCamelCase__      ( __A    :Image		):


       """simple docstring"""




       __snake_case	,    __snake_case       	=							image.size
       __snake_case       	=							0
       __snake_case       	=							image.load()
       for i in range(__A		):
              for j in range(__A		):
                     __snake_case       	=							pixels[j, i]
                     mean += pixel
       mean //= width * height

       for j in range(__A		):
              for i in range(__A		):
                     __snake_case       	=							2_5_5 if pixels[i, j] > mean else 0
       return image


if __name__ == "__main__":
    UpperCamelCase__		 =     mean_threshold(Image.open('''path_to_image''').convert('''L'''))
    image.save('''output_image_path''')

