





"""simple docstring"""


import functools

def      UpperCamelCase							(SCREAMING_SNAKE_CASE							,     SCREAMING_SNAKE_CASE     ):

						# Validation
						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				:		Dict				   =			set(SCREAMING_SNAKE_CASE     )

						@functools.cache
						def dynamic_programming(SCREAMING_SNAKE_CASE     ) -> 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()










import doctest
from collections import deque

import numpy as np







class       __A							:




      """simple docstring"""







      def __init__(		self):



             """simple docstring"""





             _lowerCamelCase				:  Any						=		[2, 1, 2, -1]
             _lowerCamelCase				:  Optional[int]						=		[1, 2, 3, 4]



      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase				:  Optional[int]						=		len(self.first_signal)
             _lowerCamelCase				:  str						=		len(self.second_signal)

             _lowerCamelCase				:  str						=		max(a__   ,				a__)

             # create a zero matrix of max_length x max_length
             _lowerCamelCase				:  Optional[Any]						=		[[0] * max_length for i in range(a__)]

             # fills the smaller signal with zeros to make both signals of same length
             if length_first_signal < length_second_signal:
                    self.first_signal += [0] * (max_length - length_first_signal)
             elif length_first_signal > length_second_signal:
                    self.second_signal += [0] * (max_length - length_second_signal)
             for i in range(a__):
                    _lowerCamelCase				:  Optional[Any]						=		deque(self.second_signal)
                    rotated_signal.rotate(a__)
                    for j, item in enumerate(a__):
                           matrix[i][j] += item

        # multiply the matrix with the first signal
             _lowerCamelCase				:  List[Any]						=		np.matmul(np.transpose(a__)   ,				np.transpose(self.first_signal))

             # rounding-off to two decimal places
             return [round(a__   ,				2) for i in final_signal]


if __name__ == "__main__":
       doctest.testmod()

