
from typing import List

from .keymap import KEYMAP, get_character







def        A__					(						lowerCamelCase						)  ->	Optional[Any]:

				def decorator(lowerCamelCase						):
								UpperCamelCase_:							List[Any]	=						getattr(lowerCamelCase     ,    """handle_key"""     ,    []						)
								handle += [key]
								setattr(lowerCamelCase     ,    """handle_key"""     ,    lowerCamelCase						)
								return func

				return decorator







def        A__					(						*lowerCamelCase						)  ->	List[Any]:

				def decorator(lowerCamelCase						):
								UpperCamelCase_:							Any	=						getattr(lowerCamelCase     ,    """handle_key"""     ,    []						)
								handle += keys
								setattr(lowerCamelCase     ,    """handle_key"""     ,    lowerCamelCase						)
								return func

				return decorator

class        _UpperCamelCase				(					_A  ):






			'''simple docstring'''

			def __new__(       cls :       int						,	snake_case_ :       str						,	snake_case_ :       Tuple						,	snake_case_ :       Union[str, Any]      ):
							UpperCamelCase_:							Tuple	=						super().__new__(cls						,	snake_case_						,	snake_case_						,	snake_case_      )
							if not hasattr(snake_case_						,	"""key_handler"""      ):
											setattr(snake_case_						,	"""key_handler"""						,	{}      )
							setattr(snake_case_						,	"""handle_input"""						,	KeyHandler.handle_input      )

							for value in attrs.values():
											UpperCamelCase_:							str	=						getattr(snake_case_						,	"""handle_key"""						,	[]      )
											for key in handled_keys:
															UpperCamelCase_:							Any	=						value
							return new_cls




			@staticmethod
			def       lowerCAmelCase__	(       cls :       int      ):
							UpperCamelCase_:							Union[str, Any]	=						get_character()
							if char != KEYMAP["undefined"]:
											UpperCamelCase_:							Any	=						ord(snake_case_      )
							UpperCamelCase_:							List[str]	=						cls.key_handler.get(snake_case_      )
							if handler:
											UpperCamelCase_:							List[Any]	=						char
											return handler(cls      )
							else:
											return None







def        A__					(						cls						)  ->	List[Any]:
				return KeyHandler(cls.__name__     ,    cls.__bases__     ,    cls.__dict__.copy()						)








def        A__					(						lowerCamelCase = 50						)  ->	int:
				UpperCamelCase_:							List[Any]	=						[[0] * 3 for _ in range(length + 1						)]

				for row_length in range(length + 1						):
								for tile_length in range(2     ,    5						):
												for tile_start in range(row_length - tile_length + 1						):
																different_colour_ways_number[row_length][tile_length - 2] += (
																    different_colour_ways_number[row_length - tile_start - tile_length][
																        tile_length - 2
																    ]
																    + 1
																)

				return sum(different_colour_ways_number[length]						)


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






