






import functools






def 							lowerCamelCase__ (       __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"""						)

  __UpperCAmelCase				:      List[str]	 =    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'''

import argparse
import hashlib  # hashlib is only used inside the Test class
import struct






class    snake_case     :






				"""simple docstring"""



				def __init__(    self,     _lowercase       )     ->							Optional[Any]:
											SCREAMING_SNAKE_CASE_				=				data
											SCREAMING_SNAKE_CASE_				=				[0x6_7_4_5_2_3_0_1, 0xe_f_c_d_a_b_8_9, 0x9_8_b_a_d_c_f_e, 0x1_0_3_2_5_4_7_6, 0xc_3_d_2_e_1_f_0]



				@staticmethod
				def   a__					(    _lowercase,     _lowercase       )     ->							List[str]:
											return ((n << b) | (n >> (32 - b))) & 0xf_f_f_f_f_f_f_f



				def   a__					(    self       )     ->							List[str]:
											SCREAMING_SNAKE_CASE_				=				B'\x80' + B'\x00' * (63 - (len(self.data       ) + 8) % 64)
											SCREAMING_SNAKE_CASE_				=				self.data + padding + struct.pack('>Q',     8 * len(self.data       )       )
											return padded_data



				def   a__					(    self       )     ->							Optional[Any]:
											return [
											    self.padded_data[i : i + 64] for i in range(0,     len(self.padded_data       ),     64       )
											]



				def   a__					(    self,     _lowercase       )     ->							int:
											SCREAMING_SNAKE_CASE_				=				list(struct.unpack('>16L',     _lowercase       )       ) + [0] * 64
											for i in range(16,     80       ):
																		SCREAMING_SNAKE_CASE_				=				self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]),     1       )
											return w





				def   a__					(    self       )     ->							List[str]:
											SCREAMING_SNAKE_CASE_				=				self.padding()
											SCREAMING_SNAKE_CASE_				=				self.split_blocks()
											for block in self.blocks:
																		SCREAMING_SNAKE_CASE_				=				self.expand_block(_lowercase       )
																		SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				self.h
																		for i in range(0,     80       ):
																									if 0 <= i < 20:
																																SCREAMING_SNAKE_CASE_				=				(b & c) | ((~b) & d)
																																SCREAMING_SNAKE_CASE_				=				0x5_a_8_2_7_9_9_9
																									elif 20 <= i < 40:
																																SCREAMING_SNAKE_CASE_				=				b ^ c ^ d
																																SCREAMING_SNAKE_CASE_				=				0x6_e_d_9_e_b_a_1
																									elif 40 <= i < 60:
																																SCREAMING_SNAKE_CASE_				=				(b & c) | (b & d) | (c & d)
																																SCREAMING_SNAKE_CASE_				=				0x8_f_1_b_b_c_d_c
																									elif 60 <= i < 80:
																																SCREAMING_SNAKE_CASE_				=				b ^ c ^ d
																																SCREAMING_SNAKE_CASE_				=				0xc_a_6_2_c_1_d_6
																									SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				(
																									    self.rotate(_lowercase,     5       ) + f + e + k + expanded_block[i] & 0xf_f_f_f_f_f_f_f,
																									    a,
																									    self.rotate(_lowercase,     30       ),
																									    c,
																									    d,
																									)
																		SCREAMING_SNAKE_CASE_				=				(
																		    self.h[0] + a & 0xf_f_f_f_f_f_f_f,
																		    self.h[1] + b & 0xf_f_f_f_f_f_f_f,
																		    self.h[2] + c & 0xf_f_f_f_f_f_f_f,
																		    self.h[3] + d & 0xf_f_f_f_f_f_f_f,
																		    self.h[4] + e & 0xf_f_f_f_f_f_f_f,
																		)
											return ("{:08x}" * 5).format(*self.h       )




def 							_UpperCamelCase				(   )      -> Optional[int]:
							SCREAMING_SNAKE_CASE_				=				B'Test String'
							assert SHAaHash(lowerCAmelCase__   ).final_hash() == hashlib.shaa(lowerCAmelCase__   ).hexdigest()  # noqa: S324




def 							_UpperCamelCase				(   )      -> Any:
							SCREAMING_SNAKE_CASE_				=				argparse.ArgumentParser(description='Process some strings or files'   )
							parser.add_argument(
							    '--string'		,dest='input_string'		,default='Hello World!! Welcome to Cryptography'		,help='Hash the string'		,)
							parser.add_argument('--file'		,dest='input_file'		,help='Hash contents of a file'   )
							SCREAMING_SNAKE_CASE_				=				parser.parse_args()
							SCREAMING_SNAKE_CASE_				=				args.input_string
							# In any case hash input should be a bytestring
							if args.input_file:
														with open(args.input_file		,'rb'   ) as f:
																					SCREAMING_SNAKE_CASE_				=				f.read()
							else:
														SCREAMING_SNAKE_CASE_				=				bytes(lowerCAmelCase__		,'utf-8'   )
							print(SHAaHash(lowerCAmelCase__   ).final_hash()   )


if __name__ == "__main__":
							main()
							import doctest

							doctest.testmod()





