




from collections.abc import Generator
from math import sin



def 							_A       (						lowerCAmelCase_					: bytes      ):
     """simple docstring"""

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

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



def 							_A       (						lowerCAmelCase_					: int      ):
     """simple docstring"""

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

     lowerCAmelCase__          =			format(lowerCAmelCase_       ,    "08x"      )[-8:]
     lowerCAmelCase__          =			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 							_A       (						lowerCAmelCase_					: bytes      ):
     """simple docstring"""

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

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

     return bit_string



def 							_A       (						lowerCAmelCase_					: bytes      ):
     """simple docstring"""

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

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



def 							_A       (						lowerCAmelCase_					: int      ):
     """simple docstring"""

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

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



def 							_A       (						lowerCAmelCase_					: int       ,    lowerCAmelCase_					: int      ):
     """simple docstring"""

     return (a + b) % 2**32



def 							_A       (						lowerCAmelCase_					: int       ,    lowerCAmelCase_					: 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 							_A       (						lowerCAmelCase_					: bytes      ):
     """simple docstring"""

     lowerCAmelCase__          =			preprocess(lowerCAmelCase_      )

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

     # Starting states
     lowerCAmelCase__          =			0X67452301
     lowerCAmelCase__          =			0XEFCDAB89
     lowerCAmelCase__          =			0X98BADCFE
     lowerCAmelCase__          =			0X10325476

     lowerCAmelCase__          =			[
         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(lowerCAmelCase_      ):
          lowerCAmelCase__          =			aa
          lowerCAmelCase__          =			ba
          lowerCAmelCase__          =			ca
          lowerCAmelCase__          =			da

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

          # Add hashed chunk to running total
          lowerCAmelCase__          =			sum_aa(lowerCAmelCase_       ,    lowerCAmelCase_      )
          lowerCAmelCase__          =			sum_aa(lowerCAmelCase_       ,    lowerCAmelCase_      )
          lowerCAmelCase__          =			sum_aa(lowerCAmelCase_       ,    lowerCAmelCase_      )
          lowerCAmelCase__          =			sum_aa(lowerCAmelCase_       ,    lowerCAmelCase_      )

     lowerCAmelCase__          =			reformat_hex(lowerCAmelCase_      ) + reformat_hex(lowerCAmelCase_      ) + reformat_hex(lowerCAmelCase_      ) + reformat_hex(lowerCAmelCase_      )
     return digest


if __name__ == "__main__":
     import doctest

     doctest.testmod()






def 							_A       (						lowerCAmelCase_					: int = 1000      ):
     """simple docstring"""

     return sum(2 * a * ((a - 1) // 2) for a in range(3       ,    n + 1      )      )


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