def       _snake_case	(   lowerCAmelCase							:   list   , lowerCAmelCase							:   list   , lowerCAmelCase							:   int	):
		"""simple docstring"""







		if len(lowerCAmelCase	) != len(lowerCAmelCase	):
				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.
		SCREAMING_SNAKE_CASE_  :		Optional[int]				      =    [p / w for p, w in zip(lowerCAmelCase   , lowerCAmelCase	)]

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

		# declaring useful variables
		SCREAMING_SNAKE_CASE_  :		Dict				      =    len(lowerCAmelCase	)
		SCREAMING_SNAKE_CASE_  :		List[Any]				      =    0
		SCREAMING_SNAKE_CASE_  :		int				      =    0
		SCREAMING_SNAKE_CASE_  :		List[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
				SCREAMING_SNAKE_CASE_  :		Optional[int]				      =    sorted_profit_by_weight[length - i - 1]
				SCREAMING_SNAKE_CASE_  :		Optional[int]				      =    profit_by_weight.index(lowerCAmelCase	)
				SCREAMING_SNAKE_CASE_  :		List[Any]				      =    -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.'''
		)

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

		# Function Call
		calc_profit(profit, weight, max_weight)

from __future__ import annotations





def    __lowercase     (						lowerCamelCase					:     Optional[Any]  ,  lowerCamelCase					:     Dict  ,  lowerCamelCase					:     Union[str, Any]  ,  lowerCamelCase					:     List[str]	):  # noqa: E741
 while r - l > 1:
  UpperCamelCase_					:						Union[str, Any] =					(l + r) // 2
  if v[m] >= key:
   UpperCamelCase_					:						str =					m
  else:
   UpperCamelCase_					:						List[Any] =					m  # noqa: E741
 return r





def    __lowercase     (						lowerCamelCase					:     list[int]	):
 if len(lowerCamelCase	) == 0:
  return 0

 UpperCamelCase_					:						Tuple =					[0] * len(lowerCamelCase	)
 UpperCamelCase_					:						int =					1

 UpperCamelCase_					:						Dict =					v[0]

 for i in range(1  ,  len(lowerCamelCase	)	):
  if v[i] < tail[0]:
   UpperCamelCase_					:						Any =					v[i]
  elif v[i] > tail[length - 1]:
   UpperCamelCase_					:						Dict =					v[i]
   length += 1
  else:
   UpperCamelCase_					:						List[str] =					v[i]

 return length


if __name__ == "__main__":
   import doctest

   doctest.testmod()



