


'''simple docstring'''



import functools



def      UpperCAmelCase__   (      UpperCAmelCase_       :							list[int] ,       UpperCAmelCase_       :							list[int]				)	->						int:

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

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

     if len(UpperCAmelCase_				) == 0:
          return 0

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

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

     __lowerCamelCase  :      List[str]														=						set(UpperCAmelCase_				)

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







def    lowerCAmelCase_  (		lowercase:				Dict		)     ->					Any:







 '''simple docstring'''
 _UpperCamelCase:  int    						=			[]
 _UpperCamelCase:  Dict    						=			set({'''(''', '''[''', '''{'''}		)
 _UpperCamelCase:  int    						=			set({''')''', ''']''', '''}'''}		)
 _UpperCamelCase:  Dict    						=			{'''{''': '''}''', '''[''': ''']''', '''(''': ''')'''}

 for i in range(len(lowercase		)		):
  if s[i] in open_brackets:
   stack.append(s[i]		)

  elif s[i] in closed_brackets and (
      len(lowercase		) == 0 or (len(lowercase		) > 0 and open_to_closed[stack.pop()] != s[i])
  ):
   return False

 return len(lowercase		) == 0




def    lowerCAmelCase_  (		)     ->					int:







 '''simple docstring'''
 _UpperCamelCase:  List[str]    						=			input('''Enter sequence of brackets: '''		)
 if is_balanced(lowercase		):
  print(lowercase	,       '''is balanced'''		)
 else:
  print(lowercase	,       '''is not balanced'''		)


if __name__ == "__main__":
  main()