
'''simple docstring'''







from bisect import bisect
from itertools import accumulate
def 					snake_case_		(				__SCREAMING_SNAKE_CASE					: Dict      ,      __SCREAMING_SNAKE_CASE					: List[Any]      ,      __SCREAMING_SNAKE_CASE					: int      ,      __SCREAMING_SNAKE_CASE					: int							):



						"""simple docstring"""





						lowercase_	:     str													=       sorted(zip(__SCREAMING_SNAKE_CASE      ,      __SCREAMING_SNAKE_CASE							)      ,      key=lambda __SCREAMING_SNAKE_CASE							: x[0] / x[1]      ,      reverse=__SCREAMING_SNAKE_CASE							)
						lowercase_						, lowercase_	:     List[Any]													=       [i[0] for i in r], [i[1] for i in r]
						lowercase_	:     List[str]													=       list(accumulate(__SCREAMING_SNAKE_CASE							)							)
						lowercase_	:     List[Any]													=       bisect(__SCREAMING_SNAKE_CASE      ,      __SCREAMING_SNAKE_CASE							)
						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()




from functools import lru_cache


@lru_cache
def    a__       (						__UpperCamelCase ):
      if num < 0:
            raise ValueError("Number should not be negative." )

      return 1 if num in (0, 1) else num * factorial(num - 1 )


if __name__ == "__main__":
      import doctest

      doctest.testmod()


