



'''simple docstring'''





def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase      ):



    """simple docstring"""





    if len(UpperCamelCase      ) <= 1:
        return [tuple(UpperCamelCase      )]

    lowerCAmelCase__			:  str											= []

    def generate(UpperCamelCase							,   UpperCamelCase      ):
        if k == 1:
            res.append(tuple(arr[:]      )      )
            return

        generate(k - 1							,   UpperCamelCase      )

        for i in range(k - 1      ):
            if k % 2 == 0:  # k is even
                lowerCAmelCase__				,       lowerCAmelCase__			:  Optional[int]											= arr[k - 1], arr[i]
            else:  # k is odd
                lowerCAmelCase__				,       lowerCAmelCase__			:  Union[str, Any]											= arr[k - 1], arr[0]
            generate(k - 1							,   UpperCamelCase      )

    generate(len(UpperCamelCase      )							,   UpperCamelCase      )
    return res


if __name__ == "__main__":
 _lowerCAmelCase										=     input('''Enter numbers separated by a comma:\n''').strip()
 _lowerCAmelCase										=     [int(item) for item in user_input.split(''',''')]
 print(heaps(arr))







'''simple docstring'''





from PIL import Image
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase      ):



    """simple docstring"""





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

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


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


