#include using namespace std; #ifdef __linux__ #define getchar getchar_unlocked #define putchar putchar_unlocked #endif bool dot; int readInt() { int n, c; while ((c = getchar()) < '0'); n = c - '0'; while ((c = getchar()) >= '0') { n = n * 10 + c - '0'; } dot = c == '.'; return n; } void writeDouble(double x) { int a = x; int b = (x - a) * 1e9; int d[15]; int i = 0; for (int j = 0; j < 9; j++) { d[i++] = b % 10 + '0'; b /= 10; } d[i++] = '.'; do { d[i++] = a % 10 + '0'; a /= 10; } while (a > 0); while (i > 0) { putchar(d[--i]); } putchar('\n'); } int main() { int m; cin >> m; while (m--) { int a = readInt(); int b = readInt(); int c = readInt(); int d = dot ? readInt() : 0; double t = c + d * 1e-4; if (b == 0) { writeDouble(pow(t, 1.0 / a)); continue; } if (a == 0) { writeDouble(exp(pow(t, 1.0 / b))); continue; } double r = 10; double l = 1; double logT = log(t); for (int ii = 0; ii < 40; ii++) { double mid = (l + r) / 2; double logN = log(mid); double loglogN = log(logN); if (a * logN + b * loglogN >= logT) { r = mid; } else { l = mid; } } writeDouble(r); } }