



from bisect import bisect
from itertools import accumulate


def 			UpperCamelCase(  __UpperCamelCase							:		Optional[int]     ,__UpperCamelCase							:		Optional[Any]     ,__UpperCamelCase							:		Dict     ,__UpperCamelCase							:		str ):
		lowerCAmelCase_			:     Union[str, Any]									= sorted(zip(__UpperCamelCase     ,__UpperCamelCase )     ,key=lambda __UpperCamelCase : x[0] / x[1]     ,reverse=__UpperCamelCase )
		lowerCAmelCase_					,  lowerCAmelCase_			:     Any									= [i[0] for i in r], [i[1] for i in r]
		lowerCAmelCase_			:     Union[str, Any]									= list(accumulate(__UpperCamelCase ) )
		lowerCAmelCase_			:     List[Any]									= bisect(__UpperCamelCase     ,__UpperCamelCase )
		return (
		    0
		    if k == 0
		    else sum(vl[:k] ) + (w - acc[k - 1]) * (vl[k]) / (wt[k])
		    if k != n
		    else sum(vl[:k] )
		)


if __name__ == "__main__":
						import doctest

						doctest.testmod()








import math
import sys







def 			A_      (    _UpperCAmelCase    ):
						if number != int(_UpperCAmelCase    ):
												raise ValueError("the value of input must be a natural number"    )
						if number < 0:
												raise ValueError("the value of input must not be a negative number"    )
						if number == 0:
												return 1
						SCREAMING_SNAKE_CASE_: List[str]  		=       [-1] * (number + 1)
						SCREAMING_SNAKE_CASE_: str  		=       0
						for i in range(1				,	number + 1    ):
												SCREAMING_SNAKE_CASE_: str  		=       sys.maxsize
												SCREAMING_SNAKE_CASE_: List[Any]  		=       int(math.sqrt(_UpperCAmelCase    )    )
												for j in range(1				,	root + 1    ):
																		SCREAMING_SNAKE_CASE_: List[str]  		=       1 + answers[i - (j**2)]
																		SCREAMING_SNAKE_CASE_: Optional[Any]  		=       min(_UpperCAmelCase				,	_UpperCAmelCase    )
												SCREAMING_SNAKE_CASE_: Dict  		=       answer
						return answers[number]


if __name__ == "__main__":
						import doctest

						doctest.testmod()






