





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 						A_			(  lowercase_  )			->						list[int]:
       return [int(lowercase_  ) for c in f'''{ruleset:08}'''[:8]]




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




def 						A_			(  lowercase_  )			->						Image.Image:
       _snake_case      :							Union[str, Any]     				=						Image.new('''RGB'''      ,		(len(cells[0]  ), len(lowercase_  ))  )
       _snake_case      :							int     				=						img.load()
       # Generates image
       for w in range(img.width  ):
              for h in range(img.height  ):
                     _snake_case      :							Optional[Any]     				=						255 - int(255 * cells[h][w]  )
                     _snake_case      :							Union[str, 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(1_6):
      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()













import numpy as np




def 						A_			(  lowercase_  )			->						Optional[Any]:
       _snake_case      :							Union[str, Any]     				=						np.exp(lowercase_  )

       # Add up the all the exponentials
       _snake_case      :							List[str]     				=						np.sum(lowercase_  )

       # Divide every exponent by the sum of all exponents
       _snake_case      :							Optional[int]     				=						exponent_vector / sum_of_exponents

       return softmax_vector


if __name__ == "__main__":
   print(softmax((0,)))






