


"""simple docstring"""







def    UpperCAmelCase__       (lowerCAmelCase_ = 10   ):




					'''simple docstring'''


					if not isinstance(lowerCAmelCase_  ,						lowerCAmelCase_   ) or n < 0:
										raise ValueError("Invalid input"   )
					__SCREAMING_SNAKE_CASE						   =				10**n
					__SCREAMING_SNAKE_CASE						   =				2_8433 * (pow(2  ,						783_0457  ,						lowerCAmelCase_   )) + 1
					return str(number % modulus   )


if __name__ == "__main__":
		from doctest import testmod

		testmod()
		print(F"{solution(1_0) = }")




"""simple docstring"""







from PIL import Image




def    UpperCAmelCase__       (lowerCAmelCase_   ):




					'''simple docstring'''


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

					for j in range(lowerCAmelCase_   ):
										for i in range(lowerCAmelCase_   ):
															__SCREAMING_SNAKE_CASE						   =				255 if pixels[i, j] > mean else 0
					return image


if __name__ == "__main__":
		a__				:							List[str]						=     mean_threshold(Image.open('''path_to_image''').convert('''L'''))
		image.save('''output_image_path''')
