#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
#define ll long long
const int maxn = 1e2 + 10;
const int INF = 0x3f3f3f3f;
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 = min(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);
}
}