




class a :
						"""simple docstring"""

						def __init__( self :     Optional[int]				,							lowerCamelCase__ :     int				)    ->						Optional[Any]:
													"""simple docstring"""


													__lowercase      =    n
													__lowercase      =    [None] * self.n
													__lowercase      =    0  # index of the first element
													__lowercase      =    0
													__lowercase      =    0






						def __len__( self :     int				)    ->						int:
													"""simple docstring"""


													return self.size






						def     UpperCAmelCase_      ( self :     Optional[int]				)    ->						bool:
													"""simple docstring"""


													return self.size == 0






						def     UpperCAmelCase_      ( self :     str				)    ->						str:
													"""simple docstring"""


													return False if self.is_empty() else self.array[self.front]






						def     UpperCAmelCase_      ( self :     List[Any]				,							lowerCamelCase__ :     List[str]				)    ->						int:
													"""simple docstring"""


													if self.size >= self.n:
																				raise Exception('''QUEUE IS FULL'''				)

													__lowercase      =    data
													__lowercase      =    (self.rear + 1) % self.n
													self.size += 1
													return self






						def     UpperCAmelCase_      ( self :     Union[str, Any]				)    ->						Any:
													"""simple docstring"""


													if self.size == 0:
																				raise Exception('''UNDERFLOW'''				)

													__lowercase      =    self.array[self.front]
													__lowercase      =    None
													__lowercase      =    (self.front + 1) % self.n
													self.size -= 1
													return temp












from __future__ import annotations







def 		_A(       UpperCamelCase__							:			list[int]				,       UpperCamelCase__							:			list[int]				,       UpperCamelCase__							:			int				)    -> tuple[float, list[float]]:
							'''simple docstring'''


							__lowercase      =    list(range(len(UpperCamelCase__				)				)				)
							__lowercase      =    [v / w for v, w in zip(UpperCamelCase__				,       UpperCamelCase__				)]
							index.sort(key=lambda UpperCamelCase__				: ratio[i]				,       reverse=UpperCamelCase__				)

							__lowercase      =    0
							__lowercase      =    [0] * len(UpperCamelCase__				)
							for i in index:
														if weight[i] <= capacity:
																					__lowercase      =    1
																					max_value += value[i]
																					capacity -= weight[i]
														else:
																					__lowercase      =    capacity / weight[i]
																					max_value += value[i] * capacity / weight[i]
																					break

							return max_value, fractions


if __name__ == "__main__":
			import doctest

			doctest.testmod()






