
"""simple docstring"""
from __future__ import annotations

from PIL import Image

# Define the first generation of cells
# fmt: off
__magic_name__		       =				[[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     __lowerCamelCase  (		UpperCamelCase__      ):


	"""simple docstring"""






	return [int(UpperCamelCase__      ) for c in f"{ruleset:08}"[:8]]




def     __lowerCamelCase  (		UpperCamelCase__				,     UpperCamelCase__				,     UpperCamelCase__      ):


	"""simple docstring"""






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




def     __lowerCamelCase  (		UpperCamelCase__      ):


	"""simple docstring"""






	_UpperCAmelCase =						Image.new("RGB"				,     (len(cells[0]      ), len(UpperCamelCase__      ))      )
	_UpperCAmelCase =						img.load()
	# Generates image
	for w in range(img.width      ):
		for h in range(img.height      ):
			_UpperCAmelCase =						255 - int(255 * cells[h][w]      )
			_UpperCAmelCase =						(color, color, color)
	return img


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






"""simple docstring"""
def     __lowerCamelCase  (		UpperCamelCase__ = 400_0000      ):


	"""simple docstring"""






	_UpperCAmelCase =						1
	_UpperCAmelCase =						2
	_UpperCAmelCase =						0
	while j <= n:
		if j % 2 == 0:
			total += j
		_UpperCAmelCase ,      _UpperCAmelCase =						j, i + j

	return total


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




