

'''simple docstring'''


from __future__ import annotations

from PIL import Image

# Define the first generation of cells
# fmt: off
lowerCAmelCase__      				=			[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]







def     SCREAMING_SNAKE_CASE(	UpperCamelCase	)     ->     Dict:
	return [int(__a	) for c in f"""{ruleset:08}"""[:8]]







def     SCREAMING_SNAKE_CASE(	UpperCamelCase ,UpperCamelCase ,UpperCamelCase	)     ->     Optional[Any]:
	UpperCAmelCase_		:   Any													=       len(cells[0]	)  # 31
	UpperCAmelCase_		:   List[str]													=       []
	for i in range(__a	):
		# Get the neighbors of each cell
		# Handle neighbours outside bounds by using 0 as their value
		UpperCAmelCase_		:   str													=       0 if i == 0 else cells[time][i - 1]
		UpperCAmelCase_		:   Optional[int]													=       0 if i == population - 1 else cells[time][i + 1]
		# Define a new cell and add it to the new generation
		UpperCAmelCase_		:   List[Any]													=       7 - int(f"""{left_neighbor}{cells[time][i]}{right_neighbor}""" ,2	)
		next_generation.append(rule[situation]	)
	return next_generation







def     SCREAMING_SNAKE_CASE(	UpperCamelCase	)     ->     Tuple:
	UpperCAmelCase_		:   Dict													=       Image.new('RGB' ,(len(cells[0]	), len(__a	))	)
	UpperCAmelCase_		:   str													=       img.load()
	# Generates image
	for w in range(img.width	):
		for h in range(img.height	):
			UpperCAmelCase_		:   Dict													=       2_5_5 - int(2_5_5 * cells[h][w]	)
			UpperCAmelCase_		:   Any													=       (color, color, color)
	return img


if __name__ == "__main__":
						lowerCAmelCase__      				=			bin(int(input("Rule:\n").strip()))[2:]
						lowerCAmelCase__      				=			format_ruleset(int(rule_num))
						for time in range(16):
												CELLS.append(new_generation(CELLS, rule, time))
						lowerCAmelCase__      				=			generate_image(CELLS)
						# Uncomment to save the image
						# img.save(f"rule_{rule_num}.png")
						img.show()











from math import gcd

def       A_   (						__a  :					int = 12_000		):

				"""simple docstring"""
				a__					   =		0
				for d in range(max_d + 1		):
								for n in range(d // 3 + 1			,		(d + 1) // 2		):
												if gcd(__a			,		__a		) == 1:
																fractions_number += 1
				return fractions_number


if __name__ == "__main__":
	print(f"""{solution() = }""")

