#include <cassert>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

#define SZ(v) ((int)(v).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) FORE(i,0,n)

double need(vector<double> share,int perc) {
	sort(share.begin(),share.end());
	vector<double> comb;
	int i1=0,i2=0;
	while(true) {
		double a,b;
		if(i1<SZ(share)&&(i2>=SZ(comb)||share[i1]<comb[i2])) a=share[i1++]; else if(i2<SZ(comb)) a=comb[i2++]; else assert(false);
		if(i1<SZ(share)&&(i2>=SZ(comb)||share[i1]<comb[i2])) b=share[i1++]; else if(i2<SZ(comb)) b=comb[i2++]; else return a;
		comb.push_back((a+b)*100/(100-perc));
	}
}

int weight,perc,n;

void run() {
	scanf("%d%d%d",&weight,&perc,&n);
	vector<double> share(n); REP(i,n) scanf("%lf",&share[i]);
	if(need(share,perc)>weight) { printf("-1\n"); return; }
	double l=0,h=weight;
	REP(i,100) {
		double m=(l+h)/2;
		share.push_back(m);
		if(need(share,perc)>weight) h=m; else l=m;
		share.pop_back();
	}
	printf("%.7lf\n",(l+h)/2);
}

int main() {
	int n; scanf("%d",&n); FORE(i,1,n) run();
	return 0;
}
