






class 							__snake_case:



 def __init__(						self : Dict						):

    """simple docstring"""






    lowercase__    :						List[str]       =			[]
    lowercase__    :						Union[str, Any]       =			0
    lowercase__    :						Optional[int]       =			0



 def __str__(						self : Dict						):

    """simple docstring"""






    lowercase__    :						Dict       =			"""<""" + str(self.entries						)[1:-1] + """>"""
    return printed



 def     UpperCAmelCase     (						self : Tuple			,		UpperCAmelCase__ : Any						):

    """simple docstring"""






    self.entries.append(UpperCAmelCase__						)
    lowercase__    :						Union[str, Any]       =			self.length + 1



 def     UpperCAmelCase     (						self : Optional[int]						):

    """simple docstring"""






    lowercase__    :						Optional[Any]       =			self.length - 1
    lowercase__    :						List[str]       =			self.entries[self.front]
    # self.front-=1
    # self.entries = self.entries[self.front:]
    lowercase__    :						List[Any]       =			self.entries[1:]
    return dequeued



 def     UpperCAmelCase     (						self : Tuple			,		UpperCAmelCase__ : Tuple						):

    """simple docstring"""






    for _ in range(UpperCAmelCase__						):
       self.put(self.get()						)



 def     UpperCAmelCase     (						self : List[str]						):

    """simple docstring"""






    return self.entries[0]



 def     UpperCAmelCase     (						self : int						):

    """simple docstring"""






    return self.length










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    a__    (	A       ):
   return [int(A       ) for c in F'''{ruleset:08}'''[:8]]
def    a__    (	A		,					A		,					A       ):
   lowercase__    :						List[Any]       =			len(cells[0]       )  # 31
   lowercase__    :						int       =			[]
   for i in range(A       ):
      # Get the neighbors of each cell
      # Handle neighbours outside bounds by using 0 as their value
      lowercase__    :						Optional[Any]       =			0 if i == 0 else cells[time][i - 1]
      lowercase__    :						Dict       =			0 if i == population - 1 else cells[time][i + 1]
      # Define a new cell and add it to the new generation
      lowercase__    :						str       =			7 - int(F'''{left_neighbor}{cells[time][i]}{right_neighbor}'''		,					2       )
      next_generation.append(rule[situation]       )
   return next_generation
def    a__    (	A       ):
   lowercase__    :						Tuple       =			Image.new("""RGB"""		,					(len(cells[0]       ), len(A       ))       )
   lowercase__    :						Optional[Any]       =			img.load()
   # Generates image
   for w in range(img.width       ):
      for h in range(img.height       ):
         lowercase__    :						Union[str, Any]       =			255 - int(255 * cells[h][w]       )
         lowercase__    :						int       =			(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()


