#include<iostream>
#include<cmath>
#define Min(a,b) (a<b?a:b)
using namespace std;
/* F(x) = 6*x^7 + 8*x^6 + 7*x^3 +5*x^2 -y*x
* F(x)'= 42x^6 + 48*x^5 + 21*x^2 + 10*x = y
*/
double get_sum(double x){
return x*x*x*x*x*x*42+x*x*x*x*x*48+x*x*21+x*10;
}
double bin_search(double Y){
double low=0;
double high=100;
double mid;
while(low<high){
mid=(low+high)/2;
//cout<<mid<<endl;
double tmp=get_sum(mid);
if( fabs(tmp - Y) < 0.00001 )
return mid;
else if(tmp > Y)
high = mid;
else
low = mid;
}
return mid;
}
int main(){
int T;
cin>>T;
while(T--){
double Y;
cin>>Y;
double x=bin_search(Y);
printf("%.4lf\n",6*pow(x,7)+8*pow(x,6)+7*x*x*x+5*x*x-Y*x);
}
return 0;
}