



"""simple docstring"""


import functools







def        lowercase		(					_SCREAMING_SNAKE_CASE      :  Tuple    ,   _SCREAMING_SNAKE_CASE      :  Optional[Any] ):






				'''simple docstring'''



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

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

				if len(__lowerCamelCase ) == 0:
								return 0

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

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

				_UpperCAmelCase							=			set(__lowerCamelCase )

				@functools.cache
				def dynamic_programming(_SCREAMING_SNAKE_CASE      :  List[str] ) -> 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()









from __future__ import annotations





def 		__A		(	__lowerCamelCase							,			__lowerCamelCase = None    )      ->       list[list[str]]:
	a										=							word_bank or []
	# create a table
	a										=							len(__lowerCamelCase    ) + 1

	a										=							[]
	for _ in range(__lowerCamelCase    ):
		table.append([]    )
	# seed value
	a										=							[[]]  # because empty string has empty combination

	# iterate through the indices
	for i in range(__lowerCamelCase    ):
		# condition
		if table[i] != []:
			for word in word_bank:
				# slice condition
				if target[i : i + len(__lowerCamelCase    )] == word:
					a										=							[
					    [word, *way] for way in table[i]
					]
					# adds the word to every combination the current position holds
					# now,push that combination to the table[i+len(word)]
					table[i + len(__lowerCamelCase    )] += new_combinations

    # combinations are in reverse order so reverse for better output
	for combination in table[len(__lowerCamelCase    )]:
		combination.reverse()

	return table[len(__lowerCamelCase    )]


if __name__ == "__main__":
		print(all_construct("jwajalapa", ["jwa", "j", "w", "a", "la", "lapa"]))
		print(all_construct("rajamati", ["s", "raj", "amat", "raja", "ma", "i", "t"]))
		print(
		    all_construct(
		        "hexagonosaurus",
		        ["h", "ex", "hex", "ag", "ago", "ru", "auru", "rus", "go", "no", "o", "s"],
		    )
		)

