



from collections.abc import Generator
from math import sin



def    snake_case_				(    _SCREAMING_SNAKE_CASE   ):
	if len(_SCREAMING_SNAKE_CASE   ) != 3_2:
		raise ValueError("Input must be of length 32"   )

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



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

	__lowercase		       =			format(_SCREAMING_SNAKE_CASE  ,	"08x"   )[-8:]
	__lowercase		       =			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    snake_case_				(    _SCREAMING_SNAKE_CASE   ):
	__lowercase		       =			b""
	for char in message:
		bit_string += format(_SCREAMING_SNAKE_CASE  ,	"08b"   ).encode("utf-8"   )
	__lowercase		       =			format(len(_SCREAMING_SNAKE_CASE   )  ,	"064b"   ).encode("utf-8"   )

	# Pad bit_string to a multiple of 512 chars
	bit_string += b"1"
	while len(_SCREAMING_SNAKE_CASE   ) % 5_1_2 != 4_4_8:
		bit_string += b"0"
	bit_string += to_little_endian(start_len[3_2:]   ) + to_little_endian(start_len[:3_2]   )

	return bit_string



def    snake_case_				(    _SCREAMING_SNAKE_CASE   ):
	if len(_SCREAMING_SNAKE_CASE   ) % 5_1_2 != 0:
		raise ValueError("Input must have length that's a multiple of 512"   )

	for pos in range(0  ,	len(_SCREAMING_SNAKE_CASE   )  ,	5_1_2   ):
		__lowercase		       =			bit_string[pos : pos + 5_1_2]
		__lowercase		       =			[]
		for i in range(0  ,	5_1_2  ,	3_2   ):
			block_words.append(int(to_little_endian(block[i : i + 3_2]   )  ,	2   )   )
		yield block_words



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

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



def    snake_case_				(    _SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE   ):
	return (a + b) % 2**3_2



def    snake_case_				(    _SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE   ):
	if i < 0:
		raise ValueError("Input must be non-negative"   )
	if shift < 0:
		raise ValueError("Shift must be non-negative"   )
	return ((i << shift) ^ (i >> (3_2 - shift))) % 2**3_2



def    snake_case_				(    _SCREAMING_SNAKE_CASE   ):
	__lowercase		       =			preprocess(_SCREAMING_SNAKE_CASE   )

	__lowercase		       =			[int(2**3_2 * abs(sin(i + 1   )   )   ) for i in range(6_4   )]

	# Starting states
	__lowercase		       =			0x6_7_4_5_2_3_0_1
	__lowercase		       =			0xe_f_c_d_a_b_8_9
	__lowercase		       =			0x9_8_b_a_d_c_f_e
	__lowercase		       =			0x1_0_3_2_5_4_7_6

	__lowercase		       =			[
	    7,
	    1_2,
	    1_7,
	    2_2,
	    7,
	    1_2,
	    1_7,
	    2_2,
	    7,
	    1_2,
	    1_7,
	    2_2,
	    7,
	    1_2,
	    1_7,
	    2_2,
	    5,
	    9,
	    1_4,
	    2_0,
	    5,
	    9,
	    1_4,
	    2_0,
	    5,
	    9,
	    1_4,
	    2_0,
	    5,
	    9,
	    1_4,
	    2_0,
	    4,
	    1_1,
	    1_6,
	    2_3,
	    4,
	    1_1,
	    1_6,
	    2_3,
	    4,
	    1_1,
	    1_6,
	    2_3,
	    4,
	    1_1,
	    1_6,
	    2_3,
	    6,
	    1_0,
	    1_5,
	    2_1,
	    6,
	    1_0,
	    1_5,
	    2_1,
	    6,
	    1_0,
	    1_5,
	    2_1,
	    6,
	    1_0,
	    1_5,
	    2_1,
	]

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

		# Hash current chunk
		for i in range(6_4   ):
			if i <= 1_5:
				# f = (b & c) | (not_32(b) & d)     # Alternate definition for f
				__lowercase		       =			d ^ (b & (c ^ d))
				__lowercase		       =			i
			elif i <= 3_1:
				# f = (d & b) | (not_32(d) & c)     # Alternate definition for f
				__lowercase		       =			c ^ (d & (b ^ c))
				__lowercase		       =			(5 * i + 1) % 1_6
			elif i <= 4_7:
				__lowercase		       =			b ^ c ^ d
				__lowercase		       =			(3 * i + 5) % 1_6
			else:
				__lowercase		       =			c ^ (b | not_aa(_SCREAMING_SNAKE_CASE   ))
				__lowercase		       =			(7 * i) % 1_6
			__lowercase		       =			(f + a + added_consts[i] + block_words[g]) % 2**3_2
			__lowercase		       =			d
			__lowercase		       =			c
			__lowercase		       =			b
			__lowercase		       =			sum_aa(_SCREAMING_SNAKE_CASE  ,	left_rotate_aa(_SCREAMING_SNAKE_CASE  ,	shift_amounts[i]   )   )

		# Add hashed chunk to running total
		__lowercase		       =			sum_aa(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE   )
		__lowercase		       =			sum_aa(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE   )
		__lowercase		       =			sum_aa(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE   )
		__lowercase		       =			sum_aa(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE   )

	__lowercase		       =			reformat_hex(_SCREAMING_SNAKE_CASE   ) + reformat_hex(_SCREAMING_SNAKE_CASE   ) + reformat_hex(_SCREAMING_SNAKE_CASE   ) + reformat_hex(_SCREAMING_SNAKE_CASE   )
	return digest


if __name__ == "__main__":
	import doctest

	doctest.testmod()








def    snake_case_				(    _SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE   ):
	if len(_SCREAMING_SNAKE_CASE   ) != len(_SCREAMING_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.
	__lowercase		       =			[p / w for p, w in zip(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE   )]

	# Creating a copy of the list and sorting profit/weight in ascending order
	__lowercase		       =			sorted(_SCREAMING_SNAKE_CASE   )

	# declaring useful variables
	__lowercase		       =			len(_SCREAMING_SNAKE_CASE   )
	__lowercase		       =			0
	__lowercase		       =			0
	__lowercase		       =			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
		__lowercase		       =			sorted_profit_by_weight[length - i - 1]
		__lowercase		       =			profit_by_weight.index(_SCREAMING_SNAKE_CASE   )
		__lowercase		       =			-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."""
	)

	snake_case__					:     str    		=   [int(x) for x in input("""Input profits separated by spaces: """).split()]
	snake_case__					:     str    		=   [int(x) for x in input("""Input weights separated by spaces: """).split()]
	snake_case__					:     Optional[Any]    		=   int(input("""Max weight allowed: """))

	# Function Call
	calc_profit(profit, weight, max_weight)



