
from __future__ import annotations

from PIL import Image

# Define the first generation of cells
# fmt: off
__SCREAMING_SNAKE_CASE     :				Optional[int]             =       [[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       UpperCAmelCase__							(    __magic_name__  :       int					):


					'''simple docstring'''

					return [int(__magic_name__					) for c in f'''{ruleset:08}'''[:8]]
def       UpperCAmelCase__							(    __magic_name__  :       list[list[int]]							,					__magic_name__  :       list[int]							,					__magic_name__  :       int					):


					'''simple docstring'''

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


					'''simple docstring'''

					lowerCAmelCase						:   Dict							=       Image.new('''RGB'''							,					(len(cells[0]					), len(__magic_name__					))					)
					lowerCAmelCase						:   List[Any]							=       img.load()
					# Generates image
					for w in range(img.width					):
										for h in range(img.height					):
															lowerCAmelCase						:   str							=       2_55 - int(2_55 * cells[h][w]					)
															lowerCAmelCase						:   Optional[Any]							=       (color, color, color)
					return img


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


def       UpperCAmelCase__							(    __magic_name__  :       int = 99_80_01					):


					'''simple docstring'''

					lowerCAmelCase						:   Tuple							=       0
					for i in range(9_99							,					99							,					-1					):  # 3 digit numbers range from 999 down to 100
										for j in range(9_99							,					99							,					-1					):
															lowerCAmelCase						:   Any							=       str(i * j					)
															if product_string == product_string[::-1] and i * j < n:
																				lowerCAmelCase						:   Optional[int]							=       max(__magic_name__							,					i * j					)
					return answer


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