



class 			lowercase				:



						"""simple docstring"""

						def __init__(    self			:		Optional[Any] ,				lowerCamelCase_			:		str					):





										'''simple docstring'''







										_snake_case :			Tuple  						=   n
										_snake_case :			Tuple  						=   [None] * self.n
										_snake_case :			Optional[int]  						=   0  # index of the first element
										_snake_case :			Tuple  						=   0
										_snake_case :			Any  						=   0







						def __len__(    self			:		Optional[Any]					):





										'''simple docstring'''







										return self.size







						def 		__UpperCAmelCase       (    self			:		List[str]					):





										'''simple docstring'''







										return self.size == 0







						def 		__UpperCAmelCase       (    self			:		int					):





										'''simple docstring'''







										return False if self.is_empty() else self.array[self.front]







						def 		__UpperCAmelCase       (    self			:		Optional[int] ,				lowerCamelCase_			:		List[str]					):





										'''simple docstring'''







										if self.size >= self.n:
														raise Exception('QUEUE IS FULL'					)

										_snake_case :			int  						=   data
										_snake_case :			Dict  						=   (self.rear + 1) % self.n
										self.size += 1
										return self







						def 		__UpperCAmelCase       (    self			:		List[Any]					):





										'''simple docstring'''







										if self.size == 0:
														raise Exception('UNDERFLOW'					)

										_snake_case :			str  						=   self.array[self.front]
										_snake_case :			int  						=   None
										_snake_case :			Any  						=   (self.front + 1) % self.n
										self.size -= 1
										return temp













import functools

def       A__(		__lowerCAmelCase	,			__lowerCAmelCase ):

				# Validation
				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 ) >= 3_66:
								raise ValueError('All days elements should be less than 366' )

				_snake_case :			Optional[int]  						=   set(__lowerCAmelCase )

				@functools.cache
				def dynamic_programming(__lowerCAmelCase ) -> int:
								if index > 3_65:
												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()






