


'''simple docstring'''






import functools


def       _snake_case     (  A				,					A )		->					int:

							# Validation
							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''' )

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



'''simple docstring'''






from manim import *




class 	a__       (							a__						):





							'''simple docstring'''






							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							List[str]:
														lowerCAmelCase__      =			Rectangle(height=0.5      ,					width=0.5     )
														lowerCAmelCase__      =			Rectangle(height=0.46      ,					width=0.46     ).set_stroke(width=0     )

														lowerCAmelCase__      =			[mem.copy() for i in range(6     )]
														lowerCAmelCase__      =			[mem.copy() for i in range(6     )]
														lowerCAmelCase__      =			VGroup(*lowerCamelCase_     ).arrange(lowerCamelCase_      ,					buff=0     )
														lowerCAmelCase__      =			VGroup(*lowerCamelCase_     ).arrange(lowerCamelCase_      ,					buff=0     )
														lowerCAmelCase__      =			VGroup(lowerCamelCase_      ,					lowerCamelCase_     ).arrange(lowerCamelCase_      ,					buff=0     )
														lowerCAmelCase__      =			Text('''CPU'''      ,					font_size=24     )
														lowerCAmelCase__      =			Group(lowerCamelCase_      ,					lowerCamelCase_     ).arrange(lowerCamelCase_      ,					buff=0.5      ,					aligned_edge=lowerCamelCase_     )
														cpu.move_to([-2.5, -0.5, 0]     )
														self.add(lowerCamelCase_     )

														lowerCAmelCase__      =			[mem.copy() for i in range(1     )]
														lowerCAmelCase__      =			VGroup(*lowerCamelCase_     ).arrange(lowerCamelCase_      ,					buff=0     )
														lowerCAmelCase__      =			Text('''GPU'''      ,					font_size=24     )
														lowerCAmelCase__      =			Group(lowerCamelCase_      ,					lowerCamelCase_     ).arrange(lowerCamelCase_      ,					buff=0.5      ,					aligned_edge=lowerCamelCase_     )
														gpu.align_to(lowerCamelCase_      ,					lowerCamelCase_     )
														gpu.set_x(gpu.get_x() - 1     )

														self.add(lowerCamelCase_     )

														lowerCAmelCase__      =			[mem.copy() for i in range(6     )]
														lowerCAmelCase__      =			VGroup(*lowerCamelCase_     ).arrange(lowerCamelCase_      ,					buff=0     )

														lowerCAmelCase__      =			Text('''Model'''      ,					font_size=24     )
														lowerCAmelCase__      =			Group(lowerCamelCase_      ,					lowerCamelCase_     ).arrange(lowerCamelCase_      ,					buff=0.5      ,					aligned_edge=lowerCamelCase_     )
														model.move_to([3, -1.0, 0]     )

														self.play(
														    Create(lowerCamelCase_      ,					run_time=1     )      ,					Create(lowerCamelCase_      ,					run_time=1     )      ,					Create(lowerCamelCase_      ,					run_time=1     )      ,					)

														lowerCAmelCase__      =			MarkupText(
														    F"""First, an empty model skeleton is loaded\ninto <span fgcolor='{YELLOW}'>memory</span> without using much RAM."""      ,					font_size=24      ,					)

														lowerCAmelCase__      =			Square(side_length=2.2     )
														key.move_to([-5, 2, 0]     )

														lowerCAmelCase__      =			MarkupText(
														    F"""<b>Key:</b>\n\n<span fgcolor='{YELLOW}'>●</span> Empty Model"""      ,					font_size=18      ,					)

														key_text.move_to([-5, 2.4, 0]     )

														step_a.move_to([2, 2, 0]     )
														self.play(Write(lowerCamelCase_      ,					run_time=2.5     )      ,					Write(lowerCamelCase_     )      ,					Write(lowerCamelCase_     )     )

														self.add(lowerCamelCase_     )

														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			[]
														lowerCAmelCase__      =			[]
														for i, rect in enumerate(lowerCamelCase_     ):
																					lowerCAmelCase__      =			Rectangle(height=0.46      ,					width=0.46     ).set_stroke(width=0.0     ).set_fill(lowerCamelCase_      ,					opacity=0.7     )
																					cpu_target.move_to(lowerCamelCase_     )
																					cpu_target.generate_target()
																					lowerCAmelCase__      =			0.46 / 4
																					lowerCAmelCase__      =			0.46 / 3

																					if i == 0:
																												cpu_target.target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT     )      ,					buff=0.02      ,					direction=lowerCamelCase_     )
																												cpu_target.target.set_x(cpu_target.target.get_x() + 0.1     )
																					elif i == 3:
																												cpu_target.target.next_to(cpu_targs[0].target      ,					direction=lowerCamelCase_      ,					buff=0.0     )
																					else:
																												cpu_target.target.next_to(cpu_targs[i - 1].target      ,					direction=lowerCamelCase_      ,					buff=0.0     )
																					cpu_targs.append(lowerCamelCase_     )

																					first_animations.append(rect.animate(run_time=0.5     ).set_stroke(lowerCamelCase_     )     )
																					second_animations.append(MoveToTarget(lowerCamelCase_      ,					run_time=1.5     )     )

														self.play(*lowerCamelCase_     )
														self.play(*lowerCamelCase_     )

														self.wait()