
"""simple docstring"""


from __future__ import annotations

from PIL import Image

# Define the first generation of cells
# fmt: off
__A       						=       [[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       )				-> list[int]:
	return [int(__UpperCamelCase       ) for c in F'''{ruleset:08}'''[:8]]



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



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


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





"""simple docstring"""


def     _lowerCamelCase(__UpperCamelCase = 4000000       )				-> int:
	_lowerCAmelCase								=1
	_lowerCAmelCase								=2
	_lowerCAmelCase								=0
	while j <= n:
		if j % 2 == 0:
			total += j
		_lowerCAmelCase						,							_lowerCAmelCase								=j, i + j

	return total


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



