


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



					'''simple docstring'''







					def __init__(					self			,							snake_case_    ) ->      str:







								'''simple docstring'''

								__lowercase			       = data
								__lowercase			       = [0X67_452_301, 0Xef_cda_b89, 0X98_bad_cfe, 0X10_325_476, 0Xc3_d2e_1f0]






					@staticmethod
					def A   (					snake_case_			,							snake_case_    ) ->      List[str]:







								'''simple docstring'''

								return ((n << b) | (n >> (3_2 - b))) & 0Xff_fff_fff






					def A   (					self    ) ->      Any:







								'''simple docstring'''

								__lowercase			       = b'\x80' + b'\x00' * (6_3 - (len(self.data    ) + 8) % 6_4)
								__lowercase			       = self.data + padding + struct.pack('''>Q'''			,							8 * len(self.data    )    )
								return padded_data






					def A   (					self    ) ->      Any:







								'''simple docstring'''

								return [
								    self.padded_data[i : i + 6_4] for i in range(0			,							len(self.padded_data    )			,							6_4    )
								]






					def A   (					self			,							snake_case_    ) ->      List[str]:







								'''simple docstring'''

								__lowercase			       = list(struct.unpack('''>16L'''			,							UpperCamelCase_    )    ) + [0] * 6_4
								for i in range(1_6			,							8_0    ):
											__lowercase			       = self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 1_4] ^ w[i - 1_6])			,							1    )
								return w






					def A   (					self    ) ->      List[Any]:







								'''simple docstring'''

								__lowercase			       = self.padding()
								__lowercase			       = self.split_blocks()
								for block in self.blocks:
											__lowercase			       = self.expand_block(UpperCamelCase_    )
											__lowercase			       = self.h
											for i in range(0			,							8_0    ):
														if 0 <= i < 2_0:
																	__lowercase			       = (b & c) | ((~b) & d)
																	__lowercase			       = 0X5a_827_999
														elif 2_0 <= i < 4_0:
																	__lowercase			       = b ^ c ^ d
																	__lowercase			       = 0X6e_d9e_ba1
														elif 4_0 <= i < 6_0:
																	__lowercase			       = (b & c) | (b & d) | (c & d)
																	__lowercase			       = 0X8f_1bb_cdc
														elif 6_0 <= i < 8_0:
																	__lowercase			       = b ^ c ^ d
																	__lowercase			       = 0Xca_62c_1d6
														__lowercase			       = (
														    self.rotate(UpperCamelCase_			,							5    ) + f + e + k + expanded_block[i] & 0Xff_fff_fff,
														    a,
														    self.rotate(UpperCamelCase_			,							3_0    ),
														    c,
														    d,
														)
											__lowercase			       = (
											    self.h[0] + a & 0Xff_fff_fff,
											    self.h[1] + b & 0Xff_fff_fff,
											    self.h[2] + c & 0Xff_fff_fff,
											    self.h[3] + d & 0Xff_fff_fff,
											    self.h[4] + e & 0Xff_fff_fff,
											)
								return ("{:08x}" * 5).format(*self.h    )




def 		lowercase_	(  ):


			'''simple docstring'''







			__lowercase			       = b'Test String'
			assert SHAaHash(_snake_case	).final_hash() == hashlib.shaa(_snake_case	).hexdigest()  # noqa: S324


def 		lowercase_	(  ):


			'''simple docstring'''







			__lowercase			       = 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'''	)
			__lowercase			       = parser.parse_args()
			__lowercase			       = args.input_string
			# In any case hash input should be a bytestring
			if args.input_file:
						with open(args.input_file							,      '''rb'''	) as f:
									__lowercase			       = f.read()
			else:
						__lowercase			       = bytes(_snake_case							,      '''utf-8'''	)
			print(SHAaHash(_snake_case	).final_hash()	)


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

	doctest.testmod()




"""simple docstring"""



def 					lowerCamelCase   (     _snake_case    ,_snake_case    ,_snake_case ):
    if len(_snake_case ) != len(_snake_case ):
        raise ValueError('The length of profit and weight must be same.' )
    if max_weight <= 0:
        raise ValueError('max_weight must greater than zero.' )
    if any(p < 0 for p in profit ):
        raise ValueError('Profit can not be negative.' )
    if any(w < 0 for w in weight ):
        raise ValueError('Weight can not be negative.' )

    # List created to store profit gained for the 1kg in case of each weight
    # respectively.  Calculate and append profit/weight for each element.
    UpperCAmelCase__	:      Any     							=					[p / w for p, w in zip(_snake_case    ,_snake_case )]

    # Creating a copy of the list and sorting profit/weight in ascending order
    UpperCAmelCase__	:      Union[str, Any]     							=					sorted(_snake_case )

    # declaring useful variables
    UpperCAmelCase__	:      Tuple     							=					len(_snake_case )
    UpperCAmelCase__	:      List[Any]     							=					0
    UpperCAmelCase__	:      Union[str, Any]     							=					0
    UpperCAmelCase__	:      Any     							=					0

    # loop till the total weight do not reach max limit e.g. 15 kg and till i<length
    while limit <= max_weight and i < length:
        # flag value for encountered greatest element in sorted_profit_by_weight
        UpperCAmelCase__	:      Tuple     							=					sorted_profit_by_weight[length - i - 1]
        UpperCAmelCase__	:      int     							=					profit_by_weight.index(_snake_case )
        UpperCAmelCase__	:      str     							=					-1

        # check if the weight encountered is less than the total weight
        # encountered before.
        if max_weight - limit >= weight[index]:
            limit += weight[index]
            # Adding profit gained for the given weight 1 ===
            # weight[index]/weight[index]
            gain += 1 * profit[index]
        else:
            # Since the weight encountered is greater than limit, therefore take the
            # required number of remaining kgs and calculate profit for it.
            # weight remaining / weight[index]
            gain += (max_weight - limit) / weight[index] * profit[index]
            break
        i += 1
    return gain


if __name__ == "__main__":
    print(
        'Input profits, weights, and then max_weight (all positive ints) separated by '
        'spaces.'
    )

    UpperCamelCase__          =	[int(x) for x in input('Input profits separated by spaces: ').split()]
    UpperCamelCase__          =	[int(x) for x in input('Input weights separated by spaces: ').split()]
    UpperCamelCase__          =	int(input('Max weight allowed: '))

    # Function Call
    calc_profit(profit, weight, max_weight)

