





import functools







def 					_SCREAMING_SNAKE_CASE							(  a   ,		a    ) -> Union[str, Any]:

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

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

					if len(__snake_case    ) == 0:
										return 0

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

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

					__A      :		str         =							set(__snake_case    )

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





'''simple docstring'''






import os
from pathlib import Path





def  _SCREAMING_SNAKE_CASE		(      ):
     from torch.utils.cpp_extension import load

     _A    		=  Path(__snake_case				).resolve().parent.parent.parent / 'kernels' / 'deformable_detr'
     _A    		=  [
         root / filename
         for filename in [
             'vision.cpp',
             os.path.join('cpu'   ,		'ms_deform_attn_cpu.cpp'				),
             os.path.join('cuda'   ,		'ms_deform_attn_cuda.cu'				),
         ]
     ]

     load(
         'MultiScaleDeformableAttention'   ,		__snake_case   ,		with_cuda=__snake_case   ,		extra_include_paths=[str(__snake_case				)]   ,		extra_cflags=['-DWITH_CUDA=1']   ,		extra_cuda_cflags=[
             '-DCUDA_HAS_FP16=1',
             '-D__CUDA_NO_HALF_OPERATORS__',
             '-D__CUDA_NO_HALF_CONVERSIONS__',
             '-D__CUDA_NO_HALF2_OPERATORS__',
         ]   ,		)

     import MultiScaleDeformableAttention as MSDA

     return MSDA



