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