




import math


def 						lowerCamelCase__    (		_A							):







	'''simple docstring'''





	snake_case_		    =     [True] * n
	snake_case_		    =     False
	snake_case_		    =     False
	snake_case_		    =     True

	for i in range(3     ,	int(n**0.5 + 1							)     ,	2							):
		snake_case_		    =     i * 2
		while index < n:
			snake_case_		    =     False
			snake_case_		    =     index + i

	snake_case_		    =     [2]

	for i in range(3     ,	_A     ,	2							):
		if is_prime[i]:
			primes.append(_A							)

	return primes


def 						lowerCamelCase__    (		_A = 999966663333							):







	'''simple docstring'''





	snake_case_		    =     math.floor(math.sqrt(_A							)							) + 100
	snake_case_		    =     prime_sieve(_A							)

	snake_case_		    =     0
	snake_case_		    =     0
	snake_case_		    =     primes[prime_index]

	while (last_prime**2) <= limit:
		snake_case_		    =     primes[prime_index + 1]

		snake_case_		    =     last_prime**2
		snake_case_		    =     next_prime**2

		# Get numbers divisible by lps(current)
		snake_case_		    =     lower_bound + last_prime
		while upper_bound > current <= limit:
			matches_sum += current
			current += last_prime

		# Reset the upper_bound
		while (upper_bound - next_prime) > limit:
			upper_bound -= next_prime

		# Add the numbers divisible by ups(current)
		snake_case_		    =     upper_bound - next_prime
		while current > lower_bound:
			matches_sum += current
			current -= next_prime

		# Remove the numbers divisible by both ups and lps
		snake_case_		    =     0
		while upper_bound > current <= limit:
			if current <= lower_bound:
				# Increment the current number
				current += last_prime * next_prime
				continue

			if current > limit:
				break

			# Remove twice since it was added by both ups and lps
			matches_sum -= current * 2

			# Increment the current number
			current += last_prime * next_prime

		# Setup for next pair
		snake_case_		    =     next_prime
		prime_index += 1

	return matches_sum


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






import functools


def 						lowerCamelCase__    (		_A     ,	_A							):







	'''simple docstring'''





	if not isinstance(_A     ,	_A							) or not all(isinstance(_A     ,	_A							) for day in days							):
		raise ValueError("The parameter days should be a list of integers"							)

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

	if len(_A							) == 0:
		return 0

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

	if max(_A							) >= 366:
		raise ValueError("All days elements should be less than 366"							)

	snake_case_		    =     set(_A							)

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