





import functools





def 	a_    (							_lowercase	,						_lowercase       ):

						# 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(_lowercase       ) -> 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()










"""simple docstring"""




from __future__ import annotations

import math





def 	a_    (							_lowercase	,						_lowercase	,						_lowercase	,						_lowercase	,						_lowercase       ):

						if depth < 0:
												raise ValueError('''Depth cannot be less than 0'''       )

						if len(_lowercase       ) == 0:
												raise ValueError('''Scores cannot be empty'''       )

						if depth == height:
												return scores[node_index]

						if is_max:
												return max(
												    minimax(depth + 1	,						node_index * 2	,						_lowercase	,						_lowercase	,						_lowercase       )	,						minimax(depth + 1	,						node_index * 2 + 1	,						_lowercase	,						_lowercase	,						_lowercase       )	,						)

						return min(
						    minimax(depth + 1	,						node_index * 2	,						_lowercase	,						_lowercase	,						_lowercase       )	,						minimax(depth + 1	,						node_index * 2 + 1	,						_lowercase	,						_lowercase	,						_lowercase       )	,						)





def 	a_    (							):
						_UpperCamelCase      : Dict         =   [90, 23, 6, 33, 21, 65, 123, 3_4423]
						_UpperCamelCase      : int         =   math.log(len(_lowercase       )	,						2       )
						print('''Optimal value : '''	,						end=''''''       )
						print(minimax(0	,						0	,						_lowercase	,						_lowercase	,						_lowercase       )       )


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						main()



