#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(void){
int T,k;
double now=0,tmp;
double a,b,x;
scanf("%d",&T);
while(T--){
scanf("%lf %lf %lf",&a,&b,&x);
if(a<x){
printf("-1\n");
continue;
}
k=(int)ceil(a/b);
now=0;
while(now<x){
int cnt=2*k-1;
tmp=(a-b*(k-1))/cnt;
tmp=(x-now>tmp?tmp:x-now);
now+=tmp;
a-=cnt*tmp;
if(x-now>b&&a<b){
a=-1;
break;
}
k--;
}
if(a<0)printf("-1\n");
else printf("%.5lf\n",a);
}
return 0;
}