



"""simple docstring"""


import numpy as np

__A   :							Optional[int]										=   [
    ["a", "b", "c", "d", "e"],
    ["f", "g", "h", "i", "k"],
    ["l", "m", "n", "o", "p"],
    ["q", "r", "s", "t", "u"],
    ["v", "w", "x", "y", "z"],
]
class 			_a :
			"""simple docstring"""



			def __init__(		self     :    Dict   )->None:
							_UpperCAmelCase					=    np.array(__UpperCamelCase   )



			def  lowercase__						(		self     :    Optional[Any]				,   __UpperCamelCase     :    str   )->np.ndarray:
							_UpperCAmelCase		,						_UpperCAmelCase					=    np.where(letter == self.SQUARE   )
							_UpperCAmelCase					=    np.concatenate([indexa + 1, indexa + 1]   )
							return indexes



			def  lowercase__						(		self     :    str				,   __UpperCamelCase     :    int				,   __UpperCamelCase     :    int   )->str:
							_UpperCAmelCase					=    self.SQUARE[indexa - 1, indexa - 1]
							return letter



			def  lowercase__						(		self     :    str				,   __UpperCamelCase     :    str   )->str:
							_UpperCAmelCase					=    message.lower()
							_UpperCAmelCase					=    message.replace(''' '''				,   ''''''   )
							_UpperCAmelCase					=    message.replace('''j'''				,   '''i'''   )

							_UpperCAmelCase					=    np.empty((2, len(__UpperCamelCase   ))   )
							for letter_index in range(len(__UpperCamelCase   )   ):
											_UpperCAmelCase					=    self.letter_to_numbers(message[letter_index]   )

											_UpperCAmelCase					=    numbers[0]
											_UpperCAmelCase					=    numbers[1]

							_UpperCAmelCase					=    first_step.reshape(2 * len(__UpperCamelCase   )   )
							_UpperCAmelCase					=    ''''''
							for numbers_index in range(len(__UpperCamelCase   )   ):
											_UpperCAmelCase					=    int(second_step[numbers_index * 2]   )
											_UpperCAmelCase					=    int(second_step[(numbers_index * 2) + 1]   )
											_UpperCAmelCase					=    self.numbers_to_letter(__UpperCamelCase				,   __UpperCamelCase   )
											_UpperCAmelCase					=    encoded_message + letter

							return encoded_message



			def  lowercase__						(		self     :    Union[str, Any]				,   __UpperCamelCase     :    str   )->str:
							_UpperCAmelCase					=    message.lower()
							message.replace(''' '''				,   ''''''   )
							_UpperCAmelCase					=    np.empty(2 * len(__UpperCamelCase   )   )
							for letter_index in range(len(__UpperCamelCase   )   ):
											_UpperCAmelCase					=    self.letter_to_numbers(message[letter_index]   )
											_UpperCAmelCase					=    numbers[0]
											_UpperCAmelCase					=    numbers[1]

							_UpperCAmelCase					=    first_step.reshape((2, len(__UpperCamelCase   ))   )
							_UpperCAmelCase					=    ''''''
							for numbers_index in range(len(__UpperCamelCase   )   ):
											_UpperCAmelCase					=    int(second_step[0, numbers_index]   )
											_UpperCAmelCase					=    int(second_step[1, numbers_index]   )
											_UpperCAmelCase					=    self.numbers_to_letter(__UpperCamelCase				,   __UpperCamelCase   )
											_UpperCAmelCase					=    decoded_message + letter

							return decoded_message








"""simple docstring"""


import functools







def  lowercase	(      _SCREAMING_SNAKE_CASE   :						list[int]					,     _SCREAMING_SNAKE_CASE   :						list[int]				):






				'''simple docstring'''



				if not isinstance(_SCREAMING_SNAKE_CASE					,     _SCREAMING_SNAKE_CASE				) or not all(isinstance(_SCREAMING_SNAKE_CASE					,     _SCREAMING_SNAKE_CASE				) for day in days				):
								raise ValueError('''The parameter days should be a list of integers'''				)

				if len(_SCREAMING_SNAKE_CASE				) != 3 or not all(isinstance(_SCREAMING_SNAKE_CASE					,     _SCREAMING_SNAKE_CASE				) for cost in costs				):
								raise ValueError('''The parameter costs should be a list of three integers'''				)

				if len(_SCREAMING_SNAKE_CASE				) == 0:
								return 0

				if min(_SCREAMING_SNAKE_CASE				) <= 0:
								raise ValueError('''All days elements should be greater than 0'''				)

				if max(_SCREAMING_SNAKE_CASE				) >= 366:
								raise ValueError('''All days elements should be less than 366'''				)

				_UpperCAmelCase					=    set(_SCREAMING_SNAKE_CASE				)

				@functools.cache
				def dynamic_programming(_SCREAMING_SNAKE_CASE   :						int				) -> int:
								if index > 365:
												return 0

								if index not in days_set:
												return dynamic_programming(index + 1				)

								return min(
								    costs[0] + dynamic_programming(index + 1				)					,     costs[1] + dynamic_programming(index + 7				)					,     costs[2] + dynamic_programming(index + 30				)					,     )

				return dynamic_programming(1				)


if __name__ == "__main__":
					import doctest

					doctest.testmod()



