```//final broken clock brokes many hearts
#include<bits/stdc++.h>
using namespace std;
#define ll long long

// #define NUM 1000000007

// #define ld long double
#define ld double

#define l long
//cin cout type macros
#define ct1(n1) cout<<n1<<"\n"
#define ct2(n1,n2) cout<<n1<<" "<<n2<<"\n"
#define ct3(n1,n2,n3) cout<<n1<<"\n"<<n2<<"\n"<<n3<<"\n"
#define ct4(n1,n2,n3,n4) cout<<n1<<"\n"<<n2<<"\n"<<n3<<"\n"<<n4<<"\n"
#define ci1(n1) cin>>n1
#define ci2(n1,n2) cin>>n1>>n2
#define ci3(n1,n2,n3) cin>>n1>>n2>>n3
#define ci4(n1,n2,n3,n4) cin>>n1>>n2>>n3>>n4
#define PI          3.14159265358979323846264

const ll mod = 1e9 + 7 ;
const l maxn =200500;
const ll inf=(2e9) + 2;// 2 foloowed by the 9 zeros and then adding two to it

ll powmod(ll a,ll b) {ll res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
ll gcd(ll a , ll b){return a==0?b:gcd(b%a,a);}//recursive gcd algorithm EUCLIDEAN dreamplay

long mygcd(long a, long b)
{
if (a == 0)//more described euclidean algorithm
return b;
else if (b == 0)
return a;

if (a < b)
return gcd(a, b % a);
else
return gcd(b, a % b);
}

// To compute (a * b) % mod
// ll muloldpositivemod(ll a, ll b, ll mod)
// {
//     ll res = 0; // Initialize result
//     a = a % mod;
//     while (b > 0)
//     {
//         // If b is odd, add 'a' to result
//         if (b % 2 == 1)
//             res = (res + a) % mod;

//         // Multiply 'a' with 2
//         a = (a * 2) % mod;

//         // Divide b by 2
//         b /= 2;
//     }

//     // Return result
//     return res % mod;
// }

/// FERMATS LITTLE THEOREM BEGIN  (Works when m is prime) which is always t obe irrespective what a is...
// To compute x raised to power y under modulo m   O(Log m)
ll expower(ll x, ll y, ll m);

// Function to find modular inverse of a under modulo m
// Assumption: m is prime
ll modInverse(ll a, ll m)//with respect to m
{
ll g = mygcd(a, m);
if (g != 1){}
// cout << "Inverse doesn't exist";

else
{
// If a and m are relatively prime, then modulo inverse
// is a^(m-2) mode m
// cout << "Modular multiplicative inverse is "
return expower(a, m-2, m);
}
}

// To compute x^y under modulo m in o(logy) recursive modualr exponentiation
ll expower(ll x, ll y, ll m)
{
if (y == 0)
return 1;
ll p = expower(x, y/2, m) % m;
p = (p * p) % m;

return (y%2 == 0)? p : (x * p) % m;
}

ll mymod (ll m, ll n) { return m >= 0 ? m % n : ( n - abs ( m%n ) ) % n; }//version 2

// to compute (a*b)%mod even when then numbers are negative /coding knight zindabad
ll mulmod( ll a, ll b, const ll c )
{
assert( c > 0 );//for runtime abortion of the case wehn modulo < 0

ll y = 0; bool negative = false;

if ( a < 0 )
a = -a, negative = !negative;

if ( b < 0 )
b = -b, negative = !negative;

if ( a < b )
swap( a, b );

for ( a %= c; b; a <<= 1, b >>= 1, a %= c )
if ( b & 1 )
y += a, y %= c;

return negative ? ( c - y ) : y;
}

// void rat_approx(long double f, int64_t md, int64_t *num, int64_t *denom)
// {
// 	/*  a: continued fraction coefficients. */
// 	int64_t a, h[3] = { 0, 1, 0 }, k[3] = { 1, 0, 0 };
// 	int64_t x, d, n = 1;
// 	ll i, neg = 0;

// 	if (md <= 1) { *denom = 1; *num = (int64_t) f; return; }

// 	if (f < 0) { neg = 1; f = -f; }

// 	while (f != floor(f)) { n <<= 1; f *= 2; }
// 	d = f;

// 	/* continued fraction and check denominator each step */
// 	for (i = 0; i < 64; i++) {
// 		a = n ? d / n : 0;
// 		if (i && !a) break;

// 		x = d; d = n; n = x % n;

// 		x = a;
// 		if (k[1] * a + k[0] >= md) {
// 			x = (md - k[0]) / k[1];
// 			if (x * 2 >= a || k[1] >= md)
// 				i = 65;
// 			else
// 				break;
// 		}

// 		h[2] = x * h[1] + h[0]; h[0] = h[1]; h[1] = h[2];
// 		k[2] = x * k[1] + k[0]; k[0] = k[1]; k[1] = k[2];
// 	}
// 	*denom = k[1];
// 	*num = neg ? -h[1] : h[1];
// }

int32_t solve();
int32_t main(int argc, char** argv) {

ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef LOCAL
FREIN("input.txt");
// FREOUT("out.txt");
#endif

//for weak judges sometimes upper thing gives an slow execution so use below

// #ifndef ONLINE_JUDGE
//     freopen("input.txt","r",stdin);
//     freopen("output2.txt","w",stdout);
// #endif

return solve();
}
int32_t solve(){
//  Broken CLOCKS_PER_SEC
//UNION FIND ALGORITHM
//FOR DISJOINT SET UNION OR DISJOINT SET DATA STRUCTURES

// !!!!!!!!!!!!!!!!!!!!!!!!! Note that ld defines the macro double here !!!!!!!!!!!!!!!!!!!!1

l Test;
ci1(Test);
ld ans=0,angle=0,length,d;//10^18 max range for an long long value
ld diff=0;
ll timer=0;ll t,result=0;
cout<<fixed<<setprecision(6);//accurate results rahenge up to 9 places for printing float double values
// ct1(9.01245454454545454);exit(0);
while(Test--){

result=0;
ans=length;
timer=0;//go to next timer
ans=d;//ans pehle next ka phir timer set
angle = (ld)((ld)acos ((ld)d/length) * (ld)180.0) / PI;//arch cosine for inverse angular calculations
// ct1(angle);
//exit(0);
diff=angle;timer++;
while(timer<t){
angle+=diff;   //byd eaFULT double values gets added

if(angle==(ld)90.0) {ans=(ld)0.0;}
else if(angle==(ld)180.0) {ans=-length;//representation
}
else if(angle==(ld)270.0) {ans=(ld)0.0;//representation
}
else if(angle==(ld)360.0) {ans=length;angle=(ld)0.0;}
else if(angle>(ld)360.0) {
angle-=(ld)360.0;

ans=(ld)((ld)(cos (angle*PI/180.0))*(ld)length);

}

else  if(angle>(ld)0.0&&angle<(ld)90.0) ans=(ld)((ld)(cos (angle*PI/180.0))*(ld)length);
ld angle2=angle;angle2-=(ld)90.0;//hee angle ki copy banayi
ans=(ld)((ld)length*(ld)((sin (angle2*PI/180.0))));
ans=-ans;
// ct1(ans);//exit(0);
}
else if(angle>(ld)180.0&&angle<(ld)270.0) {//3 qaud
ld angle2=angle;angle2-=(ld)180.0;

// angle-=180;
ans=(ld)((ld)(cos (angle2*PI/180.0))*(ld)length);
ans=-ans;
}
else if(angle>(ld)270.0&&angle<(ld)360.0){//door tak repeat nhi ho payenge vo
ld angle2=angle;angle2-=(ld)270.0;

ans=(ld)((ld)length*(ld)(sin (angle2*PI/180.0)));
}

timer++;
// ct1(angle);
}

// 	  ll i;
// 	int64_t deno, numo;
// 	  long double f;
// 	   //long double ans =(long double) ans;
// 	   //long double dio=ans;
//      f=(long double) ans;
// // 	printf("f = %16.14lf\n", f =-1016812.828360165);//16 width ke long float ki 14 digits i have to print
// // 	cout<<(f)<<"\n";
// 	for (i = 16; i <= 200000000000000000; i *= 16) {
// // 		printf("denom <= %lld: ", i);
// 		rat_approx(f, i, &numo, &deno);
// 		break;
// 	}

// here i converted it in to the rational form
// by dividing with the gcd of both after multiplying with the no of zeros raised to the power 10
// which is equivalent to the  no of digits after the decimal point as i set my pecision to the 6
// .. so all float / double values are calulated till 6 places full accurately after the decimal point\.

ll tempnum=(ll)(ans*1000000),tempdeno=1000000;
ll gco=mygcd(tempnum,tempdeno);
// ct1(gco);
ll numo=tempnum/gco;
ll deno=tempdeno/gco;

// result=mulmod(modInverse(deno,mod),numo,mod);//100% bas fraction dekh lo ab upar hai jo coding knight wale funda se

// if(numo>0) {//100
// if(deno==1) {result = moduloMultiplication(1,numo,NUM);}
// ct1(modInverse(deno,NUM));
// result = muloldpositivemod((modInverse(deno,mod)),numo,mod);//no overflow
result=mulmod((modInverse(deno,mod)),numo,mod);

ct1(result);

}

return 0;

}

```

```2
```