'''simple docstring'''






import random
import sys

import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap

_UpperCAmelCase    :     Optional[Any]         =       '''Usage of script: script_name <size_of_canvas:int>'''

_UpperCAmelCase    :     List[str]         =       [0] * 1_00 + [1] * 10
random.shuffle(choice)





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			int				):
     _A    		=  [[False for i in range(_lowerCAmelCase				)] for j in range(_lowerCAmelCase				)]
     return canvas





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			list[list[bool]]				):
     for i, row in enumerate(_lowerCAmelCase				):
          for j, _ in enumerate(_lowerCAmelCase				):
               _A    		=  bool(random.getrandbits(1				)				)





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			list[list[bool]]				):
     _A    		=  np.array(_lowerCAmelCase				)
     _A    		=  np.array(create_canvas(current_canvas.shape[0]				)				)
     for r, row in enumerate(_lowerCAmelCase				):
          for c, pt in enumerate(_lowerCAmelCase				):
               _A    		=  __judge_point(
                   _lowerCAmelCase   ,		current_canvas[r - 1 : r + 2, c - 1 : c + 2]				)

     _A    		=  next_gen_canvas
     del next_gen_canvas  # cleaning memory as we move on.
     _A    		=  current_canvas.tolist()
     return return_canvas





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			bool   ,		__snake_case							:			list[list[bool]]				):
     _A    		=  0
     _A    		=  0
     # finding dead or alive neighbours count.
     for i in neighbours:
          for status in i:
               if status:
                    alive += 1
               else:
                    dead += 1

    # handling duplicate entry for focus pt.
     if pt:
          alive -= 1
     else:
          dead -= 1

     # running the rules of game here.
     _A    		=  pt
     if pt:
          if alive < 2:
               _A    		=  False
          elif alive == 2 or alive == 3:
               _A    		=  True
          elif alive > 3:
               _A    		=  False
     else:
          if alive == 3:
               _A    		=  True

     return state


if __name__ == "__main__":
   if len(sys.argv) != 2:
      raise Exception(usage_doc)

   _UpperCAmelCase    :     List[Any]         =       int(sys.argv[1])
   # main working structure of this module.
   _UpperCAmelCase    :     Tuple         =       create_canvas(canvas_size)
   seed(c)
   _UpperCAmelCase    :     int         =       plt.subplots()
   fig.show()
   _UpperCAmelCase    :     Tuple         =       ListedColormap(['''w''', '''k'''])
   try:
      while True:
         _UpperCAmelCase    :     Tuple         =       run(c)
         ax.matshow(c, cmap=cmap)
         fig.canvas.draw()
         ax.cla()
   except KeyboardInterrupt:
      # do nothing.
      pass










def   __snake_case    (       _lowerCAmelCase			:			list					,					_lowerCAmelCase			:			list					,					_lowerCAmelCase			:			int						)			->    int:
   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.
   A_       :					Dict        =      [p / w for p, w in zip(_lowerCAmelCase					,					_lowerCAmelCase						)]

   # Creating a copy of the list and sorting profit/weight in ascending order
   A_       :					Optional[Any]        =      sorted(_lowerCAmelCase						)

   # declaring useful variables
   A_       :					List[Any]        =      len(_lowerCAmelCase						)
   A_       :					List[Any]        =      0
   A_       :					Any        =      0
   A_       :					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
      A_       :					List[Any]        =      sorted_profit_by_weight[length - i - 1]
      A_       :					List[Any]        =      profit_by_weight.index(_lowerCAmelCase						)
      A_       :					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				:   int						       =						[int(x) for x in input('''Input profits separated by spaces: ''').split()]
 _lowerCAmelCase				:   Dict						       =						[int(x) for x in input('''Input weights separated by spaces: ''').split()]
 _lowerCAmelCase				:   Union[str, Any]						       =						int(input('''Max weight allowed: '''))

 # Function Call
 calc_profit(profit, weight, max_weight)
