import math






def __lowerCAmelCase			(							UpperCamelCase__    )     ->   bool:
    return math.sqrt(_UpperCAmelCase    ) * math.sqrt(_UpperCAmelCase    ) == num






def __lowerCAmelCase			(							UpperCamelCase__    )     ->   bool:
    __lowerCamelCase          =  0
    __lowerCamelCase          =  n
    while left <= right:
        __lowerCamelCase          =  (left + right) // 2
        if mid**2 == n:
            return True
        elif mid**2 > n:
            __lowerCamelCase          =  mid - 1
        else:
            __lowerCamelCase          =  mid + 1
    return False


if __name__ == "__main__":
  import doctest

  doctest.testmod()

'''simple docstring'''




from bisect import bisect
from itertools import accumulate






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    )     ->   str:
    __lowerCamelCase          =  sorted(zip(UpperCamelCase__    ,  UpperCamelCase__    )    ,  key=lambda UpperCamelCase__    : x[0] / x[1]    ,  reverse=UpperCamelCase__    )
    __lowerCamelCase     ,  __lowerCamelCase          =  [i[0] for i in r], [i[1] for i in r]
    __lowerCamelCase          =  list(accumulate(UpperCamelCase__    )    )
    __lowerCamelCase          =  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()
