


import functools






def 							__lowercase       (			__lowerCAmelCase							:    Optional[Any] ,   __lowerCAmelCase							:    Union[str, Any]       ):

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

							a__					=					set(__lowerCAmelCase       )

							@functools.cache
							def dynamic_programming(__lowerCAmelCase							:    Any       ) -> int:
														if index > 3_6_5:
																					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 + 3_0       ) ,   )

							return dynamic_programming(1       )


if __name__ == "__main__":
			import doctest

			doctest.testmod()








from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


snake_case							:	Optional[int]					      =				{
    '''configuration_clipseg''': [
        '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''CLIPSegConfig''',
        '''CLIPSegTextConfig''',
        '''CLIPSegVisionConfig''',
    ],
    '''processing_clipseg''': ['''CLIPSegProcessor'''],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						snake_case							:	List[str]					      =				[
						    '''CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''CLIPSegModel''',
						    '''CLIPSegPreTrainedModel''',
						    '''CLIPSegTextModel''',
						    '''CLIPSegVisionModel''',
						    '''CLIPSegForImageSegmentation''',
						]

if TYPE_CHECKING:
						from .configuration_clipseg import (
						    CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    CLIPSegConfig,
						    CLIPSegTextConfig,
						    CLIPSegVisionConfig,
						)
						from .processing_clipseg import CLIPSegProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_clipseg import (
												    CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST,
												    CLIPSegForImageSegmentation,
												    CLIPSegModel,
												    CLIPSegPreTrainedModel,
												    CLIPSegTextModel,
												    CLIPSegVisionModel,
												)

else:
						import sys

						snake_case							:	Optional[int]					      =				_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




