



"""simple docstring"""







from collections.abc import Generator
from math import sin

def       _lowerCamelCase				(							UpperCAmelCase_ :       bytes     )	-> bytes:






	"""simple docstring"""





	if len(UpperCAmelCase_     ) != 32:
		raise ValueError("Input must be of length 32"     )

	A__											=					B''
	for i in [3, 2, 1, 0]:
		little_endian += string_aa[8 * i : 8 * i + 8]
	return little_endian

def       _lowerCamelCase				(							UpperCAmelCase_ :       int     )	-> bytes:






	"""simple docstring"""





	if i < 0:
		raise ValueError("Input must be non-negative"     )

	A__											=					format(UpperCAmelCase_,	"08x"     )[-8:]
	A__											=					B''
	for i in [3, 2, 1, 0]:
		little_endian_hex += hex_rep[2 * i : 2 * i + 2].encode("utf-8"     )
	return little_endian_hex

def       _lowerCamelCase				(							UpperCAmelCase_ :       bytes     )	-> bytes:






	"""simple docstring"""





	A__											=					B''
	for char in message:
		bit_string += format(UpperCAmelCase_,	"08b"     ).encode("utf-8"     )
	A__											=					format(len(UpperCAmelCase_     ),	"064b"     ).encode("utf-8"     )

	# Pad bit_string to a multiple of 512 chars
	bit_string += b"1"
	while len(UpperCAmelCase_     ) % 512 != 448:
		bit_string += b"0"
	bit_string += to_little_endian(start_len[32:]     ) + to_little_endian(start_len[:32]     )

	return bit_string

def       _lowerCamelCase				(							UpperCAmelCase_ :       bytes     )	-> Generator[list[int], None, None]:






	"""simple docstring"""





	if len(UpperCAmelCase_     ) % 512 != 0:
		raise ValueError("Input must have length that\'s a multiple of 512"     )

	for pos in range(0,	len(UpperCAmelCase_     ),	512     ):
		A__											=					bit_string[pos : pos + 512]
		A__											=					[]
		for i in range(0,	512,	32     ):
			block_words.append(int(to_little_endian(block[i : i + 32]     ),	2     )     )
		yield block_words

def       _lowerCamelCase				(							UpperCAmelCase_ :       int     )	-> int:






	"""simple docstring"""





	if i < 0:
		raise ValueError("Input must be non-negative"     )

	A__											=					format(UpperCAmelCase_,	"032b"     )
	A__											=					''
	for c in i_str:
		new_str += "1" if c == "0" else "0"
	return int(UpperCAmelCase_,	2     )

def       _lowerCamelCase				(							UpperCAmelCase_ :       int,	UpperCAmelCase_ :       int     )	-> int:






	"""simple docstring"""





	return (a + b) % 2**32

def       _lowerCamelCase				(							UpperCAmelCase_ :       int,	UpperCAmelCase_ :       int     )	-> int:






	"""simple docstring"""





	if i < 0:
		raise ValueError("Input must be non-negative"     )
	if shift < 0:
		raise ValueError("Shift must be non-negative"     )
	return ((i << shift) ^ (i >> (32 - shift))) % 2**32

def       _lowerCamelCase				(							UpperCAmelCase_ :       bytes     )	-> bytes:






	"""simple docstring"""





	A__											=					preprocess(UpperCAmelCase_     )

	A__											=					[int(2**32 * abs(sin(i + 1     )     )     ) for i in range(64     )]

	# Starting states
	A__											=					0X67_452_301
	A__											=					0Xef_cda_b89
	A__											=					0X98_bad_cfe
	A__											=					0X10_325_476

	A__											=					[
	    7,
	    12,
	    17,
	    22,
	    7,
	    12,
	    17,
	    22,
	    7,
	    12,
	    17,
	    22,
	    7,
	    12,
	    17,
	    22,
	    5,
	    9,
	    14,
	    20,
	    5,
	    9,
	    14,
	    20,
	    5,
	    9,
	    14,
	    20,
	    5,
	    9,
	    14,
	    20,
	    4,
	    11,
	    16,
	    23,
	    4,
	    11,
	    16,
	    23,
	    4,
	    11,
	    16,
	    23,
	    4,
	    11,
	    16,
	    23,
	    6,
	    10,
	    15,
	    21,
	    6,
	    10,
	    15,
	    21,
	    6,
	    10,
	    15,
	    21,
	    6,
	    10,
	    15,
	    21,
	]

	# Process bit string in chunks, each with 16 32-char words
	for block_words in get_block_words(UpperCAmelCase_     ):
		A__											=					aa
		A__											=					ba
		A__											=					ca
		A__											=					da

		# Hash current chunk
		for i in range(64     ):
			if i <= 15:
				# f = (b & c) | (not_32(b) & d)     # Alternate definition for f
				A__											=					d ^ (b & (c ^ d))
				A__											=					i
			elif i <= 31:
				# f = (d & b) | (not_32(d) & c)     # Alternate definition for f
				A__											=					c ^ (d & (b ^ c))
				A__											=					(5 * i + 1) % 16
			elif i <= 47:
				A__											=					b ^ c ^ d
				A__											=					(3 * i + 5) % 16
			else:
				A__											=					c ^ (b | not_aa(UpperCAmelCase_     ))
				A__											=					(7 * i) % 16
			A__											=					(f + a + added_consts[i] + block_words[g]) % 2**32
			A__											=					d
			A__											=					c
			A__											=					b
			A__											=					sum_aa(UpperCAmelCase_,	left_rotate_aa(UpperCAmelCase_,	shift_amounts[i]     )     )

		# Add hashed chunk to running total
		A__											=					sum_aa(UpperCAmelCase_,	UpperCAmelCase_     )
		A__											=					sum_aa(UpperCAmelCase_,	UpperCAmelCase_     )
		A__											=					sum_aa(UpperCAmelCase_,	UpperCAmelCase_     )
		A__											=					sum_aa(UpperCAmelCase_,	UpperCAmelCase_     )

	A__											=					reformat_hex(UpperCAmelCase_     ) + reformat_hex(UpperCAmelCase_     ) + reformat_hex(UpperCAmelCase_     ) + reformat_hex(UpperCAmelCase_     )
	return digest


if __name__ == "__main__":
			import doctest

			doctest.testmod()








'''simple docstring'''



A__						:   dict[tuple[int, int, int], int]				=    {}



def      UpperCAmelCase__   (      UpperCAmelCase_       :							int ,       UpperCAmelCase_       :							int ,       UpperCAmelCase_       :							int				)	->						int:

     # if we are absent twice, or late 3 consecutive days,
     # no further prize strings are possible
     if late == 3 or absent == 2:
          return 0

     # if we have no days left, and have not failed any other rules,
     # we have a prize string
     if days == 0:
          return 1

     # No easy solution, so now we need to do the recursive calculation

     # First, check if the combination is already in the cache, and
     # if yes, return the stored value from there since we already
     # know the number of possible prize strings from this point on
     __lowerCamelCase  :      List[Any]														=						(days, absent, late)
     if key in cache:
          return cache[key]

     # now we calculate the three possible ways that can unfold from
     # this point on, depending on our attendance today

     # 1) if we are late (but not absent), the "absent" counter stays as
     # it is, but the "late" counter increases by one
     __lowerCamelCase  :      Tuple														=						_calculate(days - 1 ,       UpperCAmelCase_ ,       late + 1				)

     # 2) if we are absent, the "absent" counter increases by 1, and the
     # "late" counter resets to 0
     __lowerCamelCase  :      int														=						_calculate(days - 1 ,       absent + 1 ,       0				)

     # 3) if we are on time, this resets the "late" counter and keeps the
     # absent counter
     __lowerCamelCase  :      List[Any]														=						_calculate(days - 1 ,       UpperCAmelCase_ ,       0				)

     __lowerCamelCase  :      Optional[int]														=						state_late + state_absent + state_ontime

     __lowerCamelCase  :      Union[str, Any]														=						prizestrings
     return prizestrings



def      UpperCAmelCase__   (      UpperCAmelCase_       :							int = 30				)	->						int:
     return _calculate(UpperCAmelCase_ ,       absent=0 ,       late=0				)


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






