#include<bits/stdc++.h>
using namespace std;
const double eps=1.1e-5;
inline double F(const double &x,const double &y )
{
return 6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x;
}
inline double get_derivative(const double & x,const double &y)
{
return 42*pow(x,6) + 48*pow(x,5) + 21*pow(x,2) + 10*x - y;
}
inline bool my_binary_search(double & _low,double & _high,const double & y)
{
while(_high-_low>=eps)
{
long double mid;
mid = (_low + _high) / 2;
if(get_derivative(mid,y)<0)
_low=mid;
else _high=mid;
}
return true;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin>>T;
while(T--)
{
int y;
cin>>y;
double low=0,high=100;
my_binary_search(low,high,y);
cout<<fixed<<setprecision(4)<<F(low,y)<<'\n';
}
return 0;
}