#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
unsigned short N;
double r, d, h_1, a, b;
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> r >> d >> h_1;
cout << "Case " << i << ": ";
a = asin((r - h_1) / r) - asin((r - d) / r);
if (a == 0)
cout << fixed << setprecision(4) << h_1 << endl;
else{
b = 2 * sqrt(r * r - (r - d) * (r - d)) + h_1 / sin(a);
cout << fixed << setprecision(4) << b * sin(a) << endl;
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KI2luY2x1ZGUgPGNtYXRoPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7Cgl1bnNpZ25lZCBzaG9ydCBOOwoJZG91YmxlIHIsIGQsIGhfMSwgYSwgYjsKCWNpbiA+PiBOOwoJZm9yIChpbnQgaSA9IDE7IGkgPD0gTjsgaSsrKSB7CgkJY2luID4+IHIgPj4gZCA+PiBoXzE7CgkJY291dCA8PCAiQ2FzZSAiIDw8IGkgPDwgIjogIjsKCQlhID0gYXNpbigociAtIGhfMSkgLyByKSAtIGFzaW4oKHIgLSBkKSAvIHIpOwoJCWlmIChhID09IDApCgkJCWNvdXQgPDwgZml4ZWQgPDwgc2V0cHJlY2lzaW9uKDQpIDw8IGhfMSA8PCBlbmRsOwoJCWVsc2V7CgkJCWIgPSAyICogc3FydChyICogciAtIChyIC0gZCkgKiAociAtIGQpKSArIGhfMSAvIHNpbihhKTsKCQkJY291dCA8PCBmaXhlZCA8PCBzZXRwcmVjaXNpb24oNCkgPDwgYiAqIHNpbihhKSA8PCBlbmRsOwoJCX0KCX0KCXJldHVybiAwOwp9