#include #include using namespace std; typedef long double ld; ld step = 0.1; int iters = 50; int main() { int t = 0; std::cin >> t; while (t--) { ld r, h, a, b; cin >> r >> h >> a >> b; ld ans = 0; ld xv1 = -a; ld yv1 = 0; ld zv1 = h; ld xv2 = b; ld yv2 = 0; ld zv2 = h; for (ld x = -r; x <= r; x += step) { for (ld y = -r; y <= r; y += step) { if (x * x + y * y < r * r) { ld lo = 0; ld hi = h; int iter = 0; while (iter++ < iters) { ld mid = (lo + hi) / 2; ld k = (-mid) / (zv1 - mid); ld x1 = (xv1 - x) * k + x; ld y1 = (yv1 - y) * k + y; ld x2 = (xv2 - x) * k + x; ld y2 = (yv2 - y) * k + y; if (x1 * x1 + y1 * y1 < r * r && x2 * x2 + y2 * y2 < r * r) { lo = mid; } else { hi = mid; } } cout << std::fixed << setprecision(20) << x << " " << y << " " << lo << "\n"; ans += lo * step * step; } } } cout << setprecision(20) << ans << "\n"; cout << (long long) (ans * 10) << "\n"; } return 0; }