
'''simple docstring'''



from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowerCamelCase	 =       logging.get_logger(__name__)

lowerCamelCase	 =       {
    "microsoft/swin-tiny-patch4-window7-224": (
        "https://huggingface.co/microsoft/swin-tiny-patch4-window7-224/resolve/main/config.json"
    ),
    # See all Swin models at https://huggingface.co/models?filter=swin
}





class _UpperCamelCase		(     __UpperCAmelCase      ,       __UpperCAmelCase		):





				'''simple docstring'''





				lowerCAmelCase__					    =    """swin"""

				lowerCAmelCase__					    =    {
				    """num_attention_heads""": """num_heads""",
				    """num_hidden_layers""": """num_layers""",
				}

				def __init__(							self  :  List[Any]  ,       _lowerCAmelCase  :  Union[str, Any]=2_2_4  ,       _lowerCAmelCase  :  Union[str, Any]=4  ,       _lowerCAmelCase  :  str=3  ,       _lowerCAmelCase  :  Optional[int]=9_6  ,       _lowerCAmelCase  :  List[str]=[2, 2, 6, 2]  ,       _lowerCAmelCase  :  Dict=[3, 6, 1_2, 2_4]  ,       _lowerCAmelCase  :  Dict=7  ,       _lowerCAmelCase  :  Union[str, Any]=4.0  ,       _lowerCAmelCase  :  Optional[int]=True  ,       _lowerCAmelCase  :  Dict=0.0  ,       _lowerCAmelCase  :  Dict=0.0  ,       _lowerCAmelCase  :  Dict=0.1  ,       _lowerCAmelCase  :  List[Any]="gelu"  ,       _lowerCAmelCase  :  List[Any]=False  ,       _lowerCAmelCase  :  List[Any]=0.02  ,       _lowerCAmelCase  :  List[str]=1e-5  ,       _lowerCAmelCase  :  Optional[Any]=3_2  ,       _lowerCAmelCase  :  List[str]=None  ,       _lowerCAmelCase  :  Optional[Any]=None  ,       **_lowerCAmelCase  :  int  ,       ):







											'''simple docstring'''

											super().__init__(**lowerCAmelCase_)

											__lowercase       	=image_size
											__lowercase       	=patch_size
											__lowercase       	=num_channels
											__lowercase       	=embed_dim
											__lowercase       	=depths
											__lowercase       	=len(lowerCAmelCase_)
											__lowercase       	=num_heads
											__lowercase       	=window_size
											__lowercase       	=mlp_ratio
											__lowercase       	=qkv_bias
											__lowercase       	=hidden_dropout_prob
											__lowercase       	=attention_probs_dropout_prob
											__lowercase       	=drop_path_rate
											__lowercase       	=hidden_act
											__lowercase       	=use_absolute_embeddings
											__lowercase       	=layer_norm_eps
											__lowercase       	=initializer_range
											__lowercase       	=encoder_stride
											# we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
											# this indicates the channel dimension after the last stage of the model
											__lowercase       	=int(embed_dim * 2 ** (len(lowerCAmelCase_) - 1))
											__lowercase       	=['stem'] + [f"""stage{idx}""" for idx in range(1  ,       len(lowerCAmelCase_) + 1)]
											__lowercase	,				__lowercase       	=get_aligned_output_features_output_indices(
											    out_features=lowerCAmelCase_  ,       out_indices=lowerCAmelCase_  ,       stage_names=self.stage_names)





class _UpperCamelCase		(     __UpperCAmelCase		):





				'''simple docstring'''





				lowerCAmelCase__					    =    version.parse("""1.11"""		)

				@property
				def 				__lowerCamelCase     (							self  :  Dict):







											'''simple docstring'''

											return OrderedDict(
											    [
											        ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
											    ])

				@property
				def 				__lowerCamelCase     (							self  :  Tuple):







											'''simple docstring'''

											return 1e-4








'''simple docstring'''



def   _A       (   _lowerCAmelCase  ,   _lowerCAmelCase  ,   _lowerCAmelCase					):



							"""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.
							__lowercase       	=[p / w for p, w in zip(_lowerCAmelCase  ,   _lowerCAmelCase					)]

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

							# declaring useful variables
							__lowercase       	=len(_lowerCAmelCase					)
							__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(_lowerCAmelCase					)
														__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."""
		)

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

		# Function Call
		calc_profit(profit, weight, max_weight)



