(* Pascal implementation. See maks.cpp for explanation. *)

Program Loot;

Const
    MaxAccomplices = 50;    (* max. number of accomplices *)
    SearchPasses   = 80;    (* max. error = weight*Pow(0.5,SearchPasses) *)
Type
    SharesArray = array[1 .. MaxAccomplices + 1] of Real;
Var
    (* Global variables describing a single instance of the problem *)
    weight      : LongInt;
    penalty     : Real;
    shares      : SharesArray;
    accomplices : LongInt;

(* Determines how much gold is required to be able to create the shares
   of sizes in shares[1..count] when cutting optimally. *)
Function GoldNeeded (shares : SharesArray; count : LongInt) : Real;
Var n : Longint;

Procedure Swap(Var a, b : Real);
Var c : Real;
Begin
    c := a;
    a := b;
    b := c;
End;

Procedure Push(pos : LongInt);
Var parent : LongInt;
Begin
    While (pos > 1) do
    Begin
        parent := pos div 2;
        If shares[parent] <= shares[pos] then
            Break;
        Swap(shares[parent], shares[pos]);
        pos := parent
    End
End;

Procedure Pop(pos : LongInt);
Var child, size : LongInt;
Begin
    Swap(shares[1], shares[pos]);
    size := pos - 1;
    pos  := 1;
    While ((2*pos + 0 <= size) and (shares[2*pos + 0] < shares[pos])) or
          ((2*pos + 1 <= size) and (shares[2*pos + 1] < shares[pos])) do
    Begin
        If (2*pos + 1 > size) or (shares[2*pos + 1] > shares[2*pos + 0]) then
            child := 2*pos + 0
        Else
            child := 2*pos + 1;
        Swap(shares[pos], shares[child]);
        pos := child
    End
End;

Begin
    GoldNeeded := 0;
    For n := 1 to count do
        Push(n);
    For n := count - 1 downto 1 do
    Begin
        (* Combine two smallest elements *)
        Pop(n + 1);
        Pop(n);
        shares[n] := penalty*(shares[n] + shares[n + 1]);
        Push(n);
    End;
    GoldNeeded := shares[1]
End;

(* Solves a single instance of the problem *)
Function Solve() : Real;
Var
    n           : LongInt;
    lo, mid, hi : Real;
Begin
    (* Binary search for size of my share *)
    lo := -1;
    hi := weight;
    For n := 1 to SearchPasses do
    Begin
        mid := (lo + hi)/2;
        shares[accomplices + 1] := mid;
        If (GoldNeeded(shares, accomplices + 1) < weight) then
            lo := mid
        Else
            hi := mid;
    End;
    If (Lo > 0) then
        Solve := lo
    Else If (GoldNeeded(shares, accomplices) < weight + 1E-12) then
        Solve := 0
    Else
        Solve := -1
End;

Procedure Main();
Var
    cases, c, percentage, n : LongInt;
Begin
    Read(cases);
    For c := 1 to cases do
    Begin
        Read(weight, percentage, accomplices);
        penalty := 100/(100 - percentage);
        For n := 1 to accomplices do
            Read(shares[n]);
        WriteLn(Solve():10:10)
    End
End;

Begin
    Main()
End.
