
'''simple docstring'''

import functools






def 	_snake_case						(      A_       :    list[int]     ,		A_       :    list[int]   ):
  """simple docstring"""







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

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

  if len(_SCREAMING_SNAKE_CASE   ) == 0:
    return 0

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

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

  a_      :	int      =							set(_SCREAMING_SNAKE_CASE   )

  @functools.cache
  def dynamic_programming(A_       :    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 	_snake_case						(      A_       :    list   ):
  """simple docstring"""







  if len(A_   ) <= 1:
    return [tuple(A_   )]

  a_      :	List[Any]      =							[]

  def generate(A_       :    int     ,		A_       :    list   ):
    a_      :	List[Any]      =							[0] * n
    res.append(tuple(A_   )   )

    a_      :	List[str]      =							0
    while i < n:
      if c[i] < i:
        if i % 2 == 0:
          a_      , a_      :	Union[str, Any]      =							arr[i], arr[0]
        else:
          a_      , a_      :	List[str]      =							arr[i], arr[c[i]]
        res.append(tuple(A_   )   )
        c[i] += 1
        a_      :	Optional[Any]      =							0
      else:
        a_      :	Union[str, Any]      =							0
        i += 1

  generate(len(A_   )     ,		A_   )
  return res


if __name__ == "__main__":
    __snake_case:  Dict								=			input("Enter numbers separated by a comma:\n").strip()
    __snake_case:  Optional[Any]								=			[int(item) for item in user_input.split(",")]
    print(heaps(arr))


