
'''simple docstring'''



import functools


def A (__lowerCamelCase :list[int]					,      __lowerCamelCase :list[int]						):

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

						_lowerCAmelCase    		=					set(__lowerCamelCase						)

						@functools.cache
						def dynamic_programming(__lowerCamelCase :int						) -> 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'''



def A ():
						for n in range(1					,      1000000						):
												yield n * (n + 1) // 2


def A (__lowerCamelCase :List[Any]						):
						_lowerCAmelCase    		=					1
						_lowerCAmelCase    		=					2
						while i * i <= n:
												_lowerCAmelCase    		=					0
												while n % i == 0:
																		n //= i
																		multiplicity += 1
												divisors_count *= multiplicity + 1
												i += 1
						if n > 1:
												divisors_count *= 2
						return divisors_count


def A ():
						return next(i for i in triangle_number_generator() if count_divisors(__lowerCamelCase						) > 500						)


if __name__ == "__main__":
						print(solution())
