



def       A__(		__lowerCAmelCase ):
				return "".join([hex(lowerCamelCase_ )[2:].zfill(2 ).upper() for byte in list(lowerCamelCase_ )] )

def       A__(		__lowerCAmelCase ):

				if (len(lowerCamelCase_ ) % 2) != 0:
								raise ValueError(
								    'Base16 encoded data is invalid:\nData does not have an even number of hex digits.' )
				# Check the character set - the standard base16 alphabet
				# is uppercase according to RFC3548 section 6
				if not set(lowerCamelCase_ ) <= set('0123456789ABCDEF' ):
								raise ValueError(
								    'Base16 encoded data is invalid:\nData is not uppercase hex or it contains invalid characters.' )
				# For every two hexadecimal digits (= a byte), turn it into an integer.
				# Then, string the result together into bytes, and return it.
				return bytes(int(data[i] + data[i + 1]	,			16 ) for i in range(0	,			len(lowerCamelCase_ )	,			2 ) )


if __name__ == "__main__":
		import doctest

		doctest.testmod()













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






