#pragma comment(linker, "/STACK:500000000")
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N],cnt[100][N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
int U[N],FA[N],BEL[N],DEP[N];
void dfs(int u,int fa,int bel,int dep)
{
	int l=1,r=1;
	U[l]=u; FA[l]=fa; BEL[l]=bel; DEP[l]=dep;
	while (l<=r)
	{
		u=U[l]; fa=FA[l]; bel=BEL[l]; dep=DEP[l];
		cnt[bel][dep]++;
		for (int i=h[u];i;i=e[i].n)
		{
			int v=e[i].t;
			if (v==fa) continue;
			U[++r]=v; FA[r]=u; BEL[r]=bel; DEP[r]=dep+1;
		}
		l++;
	}
	return ;
}
int sum1[N];
LL sum2[N];
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		dfs(v,1,++son,1);
	}
	for (int i=1;i<=son;i++)
	for (int j=1;j<=n;j++)
	if (cnt[i][j]) P[++idx].d=j,P[idx].w=cnt[i][j];
	sort(&P[1],&P[idx+1]);
	for (int i=1;i<=idx;i++)
	{
		sum1[i]=sum1[i-1]+P[i].w;
		sum2[i]=sum2[i-1]+(LL)P[i].w*P[i].d;
	}
	for (int i=1;i<=idx;i++)
	{
		int r=i,ll=i,rr=idx;
		while (ll<=rr)
		{
			int mid=(ll+rr)>>1;
			if ((LL)P[i].d*(sum1[mid]-sum1[i-1])-(sum2[mid]-sum2[i-1])<=p) r=mid,ll=mid+1;
			else rr=mid-1;
		}
		LL pp=(LL)P[i].d*(sum1[r]-sum1[i-1])-(sum2[r]-sum2[i-1]);
		if (r==idx) ans=max(ans,sum1[r]-sum1[i-1]);
		else
		{
			int tmp=sum1[r]-sum1[i-1]+(p-pp)/(P[i].d-P[r+1].d);
			ans=max(ans,tmp);
		}
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N],cnt[33][N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
void dfs(int u,int fa,int bel,int dep)
{
	cnt[bel][dep]++;
	for (int i=h[u];i;i=e[i].n)
	{
		int v=e[i].t;
		if (v==fa) continue;
		dfs(v,u,bel,dep+1);
	}
	return ;
}
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		dfs(v,1,++son,1);
	}
	if (son>30) printf("error!");
	for (int i=1;i<=son;i++)
	for (int j=1;j<=n;j++)
	if (cnt[i][j]) P[++idx].d=j,P[idx].w=cnt[i][j];
	sort(&P[1],&P[idx+1]);
	if (!k)
	{
		printf("0");
		return 0;
	}
	int r=1,t=0,tot=0;
	for (int i=1;i<=idx;i++)
	{
		r=max(r,i);
		t=max(t,1);
		tot=max(P[i].w,tot);
		while (r<idx)
		{
			if (P[r+1].d==P[r].d)
			{
				r++;
				tot+=P[r].w;
			}
			else if (t<p)
			{
				r++; t++;
				tot+=P[r].w;
			}
			else break;
		}
		ans=max(ans,tot);
		if (r==i||P[i].d!=P[i+1].d) t--;
		tot-=P[i].w;
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#pragma comment(linker, "/STACK:500000000")
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 1111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
int U[N],FA[N],BEL[N],DEP[N];
void dfs(int u,int fa,int bel,int dep)
{
	int l=1,r=1;
	U[l]=u; FA[l]=fa; BEL[l]=bel; DEP[l]=dep;
	while (l<=r)
	{
		u=U[l]; fa=FA[l]; bel=BEL[l]; dep=DEP[l];
		for (int i=h[u];i;i=e[i].n)
		{
			int v=e[i].t;
			if (v==fa) continue;
			U[++r]=v; FA[r]=u; BEL[r]=bel; DEP[r]=dep+1;
		}
		l++;
	}
	for (int i=1;i<=r;i++)
	if (i==1||DEP[i]!=DEP[i-1]) P[++idx].w=1,P[idx].d=DEP[i];
	else P[idx].w++;
	return ;
}
int sum1[N];
LL sum2[N];
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		dfs(v,1,++son,1);
	}
	sort(&P[1],&P[idx+1]);
	for (int i=1;i<=idx;i++)
	{
		sum1[i]=sum1[i-1]+P[i].w;
		sum2[i]=sum2[i-1]+(LL)P[i].w*P[i].d;
	}
	for (int i=1;i<=idx;i++)
	{
		int r=i,ll=i,rr=idx;
		while (ll<=rr)
		{
			int mid=(ll+rr)>>1;
			if ((LL)P[i].d*(sum1[mid]-sum1[i-1])-(sum2[mid]-sum2[i-1])<=p) r=mid,ll=mid+1;
			else rr=mid-1;
		}
		LL pp=(LL)P[i].d*(sum1[r]-sum1[i-1])-(sum2[r]-sum2[i-1]);
		if (r==idx) ans=max(ans,sum1[r]-sum1[i-1]);
		else
		{
			int tmp=sum1[r]-sum1[i-1]+(p-pp)/(P[i].d-P[r+1].d);
			ans=max(ans,tmp);
		}
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N],cnt[33][N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
int U[N],FA[N],BEL[N],DEP[N];
void dfs(int u,int fa,int bel,int dep)
{
	int l=1,r=1;
	U[l]=u; FA[l]=fa; BEL[l]=bel; DEP[l]=dep;
	while (l<=r)
	{
		u=U[l]; fa=FA[l]; bel=BEL[l]; dep=DEP[l];
		cnt[bel][dep]++;
		for (int i=h[u];i;i=e[i].n)
		{
			int v=e[i].t;
			if (v==fa) continue;
			U[++r]=v; FA[r]=u; BEL[r]=bel; DEP[r]=dep+1;
		}
		l++;
	}
	return ;
}
int sum1[N];
LL sum2[N];
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		dfs(v,1,++son,1);
	}
	for (int i=1;i<=son;i++)
	for (int j=1;j<=n;j++)
	if (cnt[i][j]) P[++idx].d=j,P[idx].w=cnt[i][j];
	sort(&P[1],&P[idx+1]);
	for (int i=1;i<=idx;i++)
	{
		sum1[i]=sum1[i-1]+P[i].w;
		sum2[i]=sum2[i-1]+P[i].w*P[i].d;
	}
	for (int i=1;i<=idx;i++)
	{
		int r=i,ll=i,rr=idx;
		while (ll<=rr)
		{
			int mid=(ll+rr)>>1;
			if (P[i].d*(sum1[mid]-sum1[i-1])-(sum2[mid]-sum2[i-1])<=p) r=mid,ll=mid+1;
			else rr=mid-1;
		}
		LL pp=P[i].d*(sum1[r]-sum1[i-1])-(sum2[r]-sum2[i-1]);
		if (r==idx) ans=max(ans,sum1[r]-sum1[i-1]);
		else
		{
			int tmp=sum1[r]-sum1[i-1]+(p-pp)/(P[i].d-P[r+1].d);
			ans=max(ans,tmp);
		}
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N],cnt[33][N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
int U[N],FA[N],BEL[N],DEP[N];
void dfs(int u,int fa,int bel,int dep)
{
	int l=1,r=1;
	U[l]=u; FA[l]=fa; BEL[l]=bel; DEP[l]=dep;
	while (l<=r)
	{
		u=U[l]; fa=FA[l]; bel=BEL[l]; dep=DEP[l];
		cnt[bel][dep]++;
		for (int i=h[u];i;i=e[i].n)
		{
			int v=e[i].t;
			if (v==fa) continue;
			U[++r]=v; FA[r]=u; BEL[r]=bel; DEP[r]=dep+1;
		}
		l++;
	}
	return ;
}
int sum1[N];
LL sum2[N];
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		dfs(v,1,++son,1);
	}
	for (int i=1;i<=son;i++)
	for (int j=1;j<=n;j++)
	if (cnt[i][j]) P[++idx].d=j,P[idx].w=cnt[i][j];
	sort(&P[1],&P[idx+1]);
	for (int i=1;i<=idx;i++)
	{
		sum1[i]=sum1[i-1]+P[i].w;
		sum2[i]=sum2[i-1]+(LL)P[i].w*P[i].d;
	}
	for (int i=1;i<=idx;i++)
	{
		int r=i,ll=i,rr=idx;
		while (ll<=rr)
		{
			int mid=(ll+rr)>>1;
			if ((LL)P[i].d*(sum1[mid]-sum1[i-1])-(sum2[mid]-sum2[i-1])<=p) r=mid,ll=mid+1;
			else rr=mid-1;
		}
		LL pp=(LL)P[i].d*(sum1[r]-sum1[i-1])-(sum2[r]-sum2[i-1]);
		if (r==idx) ans=max(ans,sum1[r]-sum1[i-1]);
		else
		{
			int tmp=sum1[r]-sum1[i-1]+(p-pp)/(P[i].d-P[r+1].d);
			ans=max(ans,tmp);
		}
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N],cnt[33][N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
void dfs(int u,int fa,int bel,int dep)
{
	cnt[bel][dep]++;
	for (int i=h[u];i;i=e[i].n)
	{
		int v=e[i].t;
		if (v==fa) continue;
		dfs(v,u,bel,dep+1);
	}
	return ;
}
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		dfs(v,1,++son,1);
	}
	for (int i=1;i<=son;i++)
	for (int j=1;j<=n;j++)
	if (cnt[i][j]) P[++idx].d=j,P[idx].w=cnt[i][j];
	sort(&P[1],&P[idx+1]);
	if (!k)
	{
		printf("0");
		return 0;
	}
	int r=1,t=0,tot=0,cnt=0;
	for (int i=1;i<=idx;i++)
	{
		r=i; tot=P[i].w; cnt=0;
		int pp=0;
		while (P[r+1].d==P[i].d)
		{
			r++;
			tot+=P[r].w;
		}
		while (r<idx&&pp+(P[i].d-P[r+1].d)*P[r+1].w<=p)
		{
			r++;
			pp+=(P[i].d-P[r].d)*P[r].w;
			tot+=P[r].w;
		}
		if (r==idx) ans=max(ans,tot);
		else ans=max(ans,tot+(p-pp)/(P[i].d-P[r+1].d));
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#pragma comment(linker, "/STACK:500000000")
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N],cnt[33][N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
int U[N],FA[N],BEL[N],DEP[N];
void dfs(int u,int fa,int bel,int dep)
{
	int l=1,r=1;
	U[l]=u; FA[l]=fa; BEL[l]=bel; DEP[l]=dep;
	while (l<=r)
	{
		u=U[l]; fa=FA[l]; bel=BEL[l]; dep=DEP[l];
		cnt[bel][dep]++;
		for (int i=h[u];i;i=e[i].n)
		{
			int v=e[i].t;
			if (v==fa) continue;
			U[++r]=v; FA[r]=u; BEL[r]=bel; DEP[r]=dep+1;
		}
		l++;
	}
	return ;
}
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		dfs(v,1,++son,1);
	}
	for (int i=1;i<=son;i++)
	for (int j=1;j<=n;j++)
	if (cnt[i][j]) P[++idx].d=j,P[idx].w=cnt[i][j];
	sort(&P[1],&P[idx+1]);
	if (!k)
	{
		printf("0");
		return 0;
	}
	int r=1,t=0,tot=0,cnt=0;
	for (int i=1;i<=idx;i++)
	{
		r=i; tot=P[i].w; cnt=0;
		int pp=0;
		while (P[r+1].d==P[i].d)
		{
			r++;
			tot+=P[r].w;
		}
		while (r<idx&&pp+(P[i].d-P[r+1].d)*P[r+1].w<=p)
		{
			r++;
			pp+=(P[i].d-P[r].d)*P[r].w;
			tot+=P[r].w;
		}
		if (r==idx) ans=max(ans,tot);
		else ans=max(ans,tot+(p-pp)/(P[i].d-P[r+1].d));
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#pragma comment(linker, "/STACK:500000000")
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N],cnt[33][N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
void dfs(int u,int fa,int bel,int dep)
{
	cnt[bel][dep]++;
	for (int i=h[u];i;i=e[i].n)
	{
		int v=e[i].t;
		if (v==fa) continue;
		dfs(v,u,bel,dep+1);
	}
	return ;
}
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		dfs(v,1,++son,1);
	}
	for (int i=1;i<=son;i++)
	for (int j=1;j<=n;j++)
	if (cnt[i][j]) P[++idx].d=j,P[idx].w=cnt[i][j];
	sort(&P[1],&P[idx+1]);
	if (!k)
	{
		printf("0");
		return 0;
	}
	int r=1,t=0,tot=0,cnt=0;
	for (int i=1;i<=idx;i++)
	{
		r=i; tot=P[i].w; cnt=0;
		int pp=0;
		while (P[r+1].d==P[i].d)
		{
			r++;
			tot+=P[r].w;
		}
		while (r<idx&&pp+(P[i].d-P[r+1].d)*P[r+1].w<=p)
		{
			r++;
			pp+=(P[i].d-P[r].d)*P[r].w;
			tot+=P[r].w;
		}
		if (r==idx) ans=max(ans,tot);
		else ans=max(ans,tot+(p-pp)/(P[i].d-P[r+1].d));
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#pragma comment(linker, "/STACK:500000000")
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 1111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
int U[N],FA[N],BEL[N],DEP[N];
void dfs(int u,int fa,int bel,int dep)
{
	int l=1,r=1;
	U[l]=u; FA[l]=fa; BEL[l]=bel; DEP[l]=dep;
	while (l<=r)
	{
		u=U[l]; fa=FA[l]; bel=BEL[l]; dep=DEP[l];
		for (int i=h[u];i;i=e[i].n)
		{
			int v=e[i].t;
			if (v==fa) continue;
			U[++r]=v; FA[r]=u; BEL[r]=bel; DEP[r]=dep+1;
		}
		l++;
	}
	for (int i=l;i<=r;i++)
	if (i==1||DEP[i]!=DEP[i-1]) P[++idx].w=1,P[idx].d=DEP[i];
	else P[idx].w++;
	return ;
}
int sum1[N];
LL sum2[N];
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		dfs(v,1,++son,1);
	}
	sort(&P[1],&P[idx+1]);
	for (int i=1;i<=idx;i++)
	{
		sum1[i]=sum1[i-1]+P[i].w;
		sum2[i]=sum2[i-1]+(LL)P[i].w*P[i].d;
	}
	for (int i=1;i<=idx;i++)
	{
		int r=i,ll=i,rr=idx;
		while (ll<=rr)
		{
			int mid=(ll+rr)>>1;
			if ((LL)P[i].d*(sum1[mid]-sum1[i-1])-(sum2[mid]-sum2[i-1])<=p) r=mid,ll=mid+1;
			else rr=mid-1;
		}
		LL pp=(LL)P[i].d*(sum1[r]-sum1[i-1])-(sum2[r]-sum2[i-1]);
		if (r==idx) ans=max(ans,sum1[r]-sum1[i-1]);
		else
		{
			int tmp=sum1[r]-sum1[i-1]+(p-pp)/(P[i].d-P[r+1].d);
			ans=max(ans,tmp);
		}
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#pragma comment(linker, "/STACK:500000000")
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#define INF 1111111111
#define N 1111111
#define eps 1e-9
using namespace std;
typedef long long LL;
int getint()
{
	char ch;
	do
	{
		ch=getchar();
	}while (ch!='-'&&(ch<'0'||ch>'9'));
	int ans=0,f=0;
	if (ch=='-') f=1; else ans=ch-'0';
	while (isdigit(ch=getchar())) ans=ans*10+ch-'0';
	if (f) ans*=-1;
	return ans;
}
struct edge
{
	int t,n;
}e[N*2];
struct point
{
	int d,w;
	bool operator < (const point&rhs) const
	{
		if (d!=rhs.d) return d>rhs.d;
		return w>rhs.w;
	}
}P[N];
int h[N],cnt[33][N];
int n,k,p,tote,idx,son,ans=1;
void adde(int f,int t)
{
	e[++tote].t=t;
	e[tote].n=h[f];
	h[f]=tote;
	return ;
}
int U[N],FA[N],BEL[N],DEP[N];
void dfs(int u,int fa,int bel,int dep)
{
	int l=1,r=1;
	U[l]=u; FA[l]=fa; BEL[l]=bel; DEP[l]=dep;
	while (l<=r)
	{
		u=U[l]; fa=FA[l]; bel=BEL[l]; dep=DEP[l];
		cnt[bel][dep]++;
		for (int i=h[u];i;i=e[i].n)
		{
			int v=e[i].t;
			if (v==fa) continue;
			U[++r]=v; FA[r]=u; BEL[r]=bel; DEP[r]=dep+1;
		}
		l++;
	}
	return ;
}
int sum1[N];
LL sum2[N];
int main()
{
	n=getint(); k=getint(); p=getint();
	for (int i=1;i<n;i++)
	{
		int u=getint(),v=getint();
		adde(u,v); adde(v,u);
	}
	for (int i=h[1];i;i=e[i].n)
	{
		int v=e[i].t;
		if (++son>30) while (1);
		dfs(v,1,son,1);
	}
	for (int i=1;i<=son;i++)
	for (int j=1;j<=n;j++)
	if (cnt[i][j]) P[++idx].d=j,P[idx].w=cnt[i][j];
	sort(&P[1],&P[idx+1]);
	for (int i=1;i<=idx;i++)
	{
		sum1[i]=sum1[i-1]+P[i].w;
		sum2[i]=sum2[i-1]+(LL)P[i].w*P[i].d;
	}
	for (int i=1;i<=idx;i++)
	{
		int r=i,ll=i,rr=idx;
		while (ll<=rr)
		{
			int mid=(ll+rr)>>1;
			if ((LL)P[i].d*(sum1[mid]-sum1[i-1])-(sum2[mid]-sum2[i-1])<=p) r=mid,ll=mid+1;
			else rr=mid-1;
		}
		LL pp=(LL)P[i].d*(sum1[r]-sum1[i-1])-(sum2[r]-sum2[i-1]);
		if (r==idx) ans=max(ans,sum1[r]-sum1[i-1]);
		else
		{
			int tmp=sum1[r]-sum1[i-1]+(p-pp)/(P[i].d-P[r+1].d);
			ans=max(ans,tmp);
		}
	}
	ans=min(ans,k);
	printf("%d\n",ans);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
#define mod 1e9+7
#define for(i,nn,mm) for(int i=nn;i<=mm;i++)
typedef long long LL;
const int maxn=100005;
double x,y,n,m;
int t;
int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%lf%lf",&n,&m);
		if(m==0)printf("0\n");
		else if(n>4*m)printf("%.10lf",(m*n+n*n/8.0-(n/4.0-m)*(n/4.0-m)*2)/(2.0*n*m));
		else printf("%.10lf\n",(m+n/8.0)/(2.0*m));
	}
	return 0;
}


#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define sz(a) (int)a.size()
#define fs first
#define sc second

typedef long long ll;
typedef pair<int,int> ii;

const double EPS = 1e-7;

struct Point {
    double x, y;
    Point(double _x = 0.0, double _y = 0.0) {
        x = _x;
        y = _y;
    }
};

struct Line {
    double a, b, c;
    Line(double _a = 0.0, double _b = 0.0, double _c = 0.0) {
        a = _a;
        b = _b;
        c = _c;
    }
};

int cmp(double a, double b) {
    if (abs(a-b)<EPS) return 0;
    if (a-b > EPS) return 1;
    return -1;
}

bool isParalel(Line l1, Line l2) {
    return cmp(l1.a*l2.b,l1.b*l2.a)==0;
}

bool intersect(Line l1, Line l2, Point & p) {
    if (isParalel(l1,l2)) return false;
    double dx = l1.b*l2.c - l2.b*l1.c;
    double dy = l1.c*l2.a - l2.c*l1.a;
    double d =  l1.a*l2.b - l2.a*l1.b;
    p.x = dx/d, p.y = dy/d;
    return true;
}

int main() {
    //freopen("input.txt","r",stdin);
    int t; scanf("%d",&t);
    while (t--) {
        int a, b;
        scanf("%d%d",&a,&b);
        if (a==0) {
            cout << "1.00000000" << endl;
            continue;
        }
        Line l1 = Line(0,1,-b), l2 = Line(1,0,-a), l3 = Line(1,-4,0);
        Point p;
        bool tmp = intersect(l1,l3,p);
        double x;
        if (cmp(p.x,(double)a) == 1) {
            tmp = intersect(l2,l3,p);
            x = (double)a*(double)b - p.x*p.y*0.5;
        }
        else x = p.x*p.y*0.5;
        printf("%.8lf\n",1.0-x/((2.0*(double)b)*(double)a));

    }
    return 0;
}


#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define sz(a) (int)a.size()
#define fs first
#define sc second

typedef long long ll;
typedef pair<int,int> ii;

const double EPS = 1e-7;

struct Point {
    double x, y;
    Point(double _x = 0.0, double _y = 0.0) {
        x = _x;
        y = _y;
    }
};

struct Line {
    double a, b, c;
    Line(double _a = 0.0, double _b = 0.0, double _c = 0.0) {
        a = _a;
        b = _b;
        c = _c;
    }
};

int cmp(double a, double b) {
    if (abs(a-b)<EPS) return 0;
    if (a-b > EPS) return 1;
    return -1;
}

bool isParalel(Line l1, Line l2) {
    return cmp(l1.a*l2.b,l1.b*l2.a)==0;
}

bool intersect(Line l1, Line l2, Point & p) {
    if (isParalel(l1,l2)) return false;
    double dx = l1.b*l2.c - l2.b*l1.c;
    double dy = l1.c*l2.a - l2.c*l1.a;
    double d =  l1.a*l2.b - l2.a*l1.b;
    p.x = dx/d, p.y = dy/d;
    return true;
}

int main() {
    //freopen("input.txt","r",stdin);
    int t; scanf("%d",&t);
    while (t--) {
        int a, b;
        scanf("%d%d",&a,&b);
        Line l1 = Line(0,1,-b), l2 = Line(1,0,-a), l3 = Line(1,-4,0);
        Point p;
        bool tmp = intersect(l1,l3,p);
        double x;
        if (cmp(p.x,(double)a) == 1) {
            tmp = intersect(l2,l3,p);
            x = (double)a*(double)b - p.x*p.y*0.5;
        }
        else x = p.x*p.y*0.5;
        printf("%.8lf\n",1.0-x/((2.0*(double)b)*(double)a));

    }
    return 0;
}


#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define sz(a) (int)a.size()
#define fs first
#define sc second

typedef long long ll;
typedef pair<int,int> ii;

const double EPS = 1e-7;

struct Point {
    double x, y;
    Point(double _x = 0.0, double _y = 0.0) {
        x = _x;
        y = _y;
    }
};

struct Line {
    double a, b, c;
    Line(double _a = 0.0, double _b = 0.0, double _c = 0.0) {
        a = _a;
        b = _b;
        c = _c;
    }
};

bool cmp(double a, double b) {
    if (abs(a-b)<EPS) return 0;
    if (a-b > EPS) return 1;
    return -1;
}

bool isParalel(Line l1, Line l2) {
    return cmp(l1.a*l2.b,l1.b*l2.a)==0;
}

bool intersect(Line l1, Line l2, Point & p) {
    if (isParalel(l1,l2)) return false;
    double dx = l1.b*l2.c - l2.b*l1.c;
    double dy = l1.c*l2.a - l2.c*l1.a;
    double d =  l1.a*l2.b - l2.a*l1.b;
    p.x = dx/d, p.y = dy/d;
    return true;
}

int main() {
    ///freopen("input.txt","r",stdin);
    int t; scanf("%d",&t);
    while (t--) {
        int a, b;
        scanf("%d%d",&a,&b);
        Line l1 = Line(0,1,-b), l2 = Line(1,0,-a), l3 = Line(1,-4,0);
        Point p;
        bool tmp = intersect(l1,l3,p);
        double x;
        if (cmp(p.x,(double)a) == 1) {
            tmp = intersect(l2,l3,p);
            x = (double)a*(double)b - p.x*p.y*0.5;
        }
        else x = p.x*p.y*0.5;
        printf("%.8lf\n",1.0-x/((2.0*(double)b)*(double)a));

    }
    return 0;
}


#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define sz(a) (int)a.size()
#define fs first
#define sc second

typedef long long ll;
typedef pair<int,int> ii;

const double EPS = 1e-7;

struct Point {
    double x, y;
    Point(double _x = 0.0, double _y = 0.0) {
        x = _x;
        y = _y;
    }
};

struct Line {
    double a, b, c;
    Line(double _a = 0.0, double _b = 0.0, double _c = 0.0) {
        a = _a;
        b = _b;
        c = _c;
    }
};

int cmp(double a, double b) {
    if (abs(a-b)<EPS) return 0;
    if (a-b > EPS) return 1;
    return -1;
}

bool isParalel(Line l1, Line l2) {
    return cmp(l1.a*l2.b,l1.b*l2.a)==0;
}

bool intersect(Line l1, Line l2, Point & p) {
    if (isParalel(l1,l2)) return false;
    double dx = l1.b*l2.c - l2.b*l1.c;
    double dy = l1.c*l2.a - l2.c*l1.a;
    double d =  l1.a*l2.b - l2.a*l1.b;
    p.x = dx/d, p.y = dy/d;
    return true;
}

int main() {
    //freopen("input.txt","r",stdin);
    int t; scanf("%d",&t);
    while (t--) {
        int a, b;
        scanf("%d%d",&a,&b);
        if (a==0&&b==0) {
            cout << "1.00000000" << endl;
            continue;
        }
        if (a==0) {
            cout << "0.5" << endl;
            continue;
        }
        if (b==0) {
            cout << "1" << endl;
            continue;
        }
        Line l1 = Line(0,1,-b), l2 = Line(1,0,-a), l3 = Line(1,-4,0);
        Point p;
        bool tmp = intersect(l1,l3,p);
        double x;
        if (cmp(p.x,(double)a) == 1) {
            tmp = intersect(l2,l3,p);
            x = (double)a*(double)b - p.x*p.y*0.5;
        }
        else x = p.x*p.y*0.5;
        printf("%.8lf\n",1.0-x/((2.0*(double)b)*(double)a));

    }
    return 0;
}


#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define sz(a) (int)a.size()
#define fs first
#define sc second

typedef long long ll;
typedef pair<int,int> ii;

const double EPS = 1e-7;

struct Point {
    double x, y;
    Point(double _x = 0.0, double _y = 0.0) {
        x = _x;
        y = _y;
    }
};

struct Line {
    double a, b, c;
    Line(double _a = 0.0, double _b = 0.0, double _c = 0.0) {
        a = _a;
        b = _b;
        c = _c;
    }
};

int cmp(double a, double b) {
    if (abs(a-b)<EPS) return 0;
    if (a-b > EPS) return 1;
    return -1;
}

bool isParalel(Line l1, Line l2) {
    return cmp(l1.a*l2.b,l1.b*l2.a)==0;
}

bool intersect(Line l1, Line l2, Point & p) {
    if (isParalel(l1,l2)) return false;
    double dx = l1.b*l2.c - l2.b*l1.c;
    double dy = l1.c*l2.a - l2.c*l1.a;
    double d =  l1.a*l2.b - l2.a*l1.b;
    p.x = dx/d, p.y = dy/d;
    return true;
}

int main() {
    //freopen("input.txt","r",stdin);
    int t; scanf("%d",&t);
    while (t--) {
        int a, b;
        scanf("%d%d",&a,&b);
        if (a==0 && b ==0) {
            cout << "1.00000000" << endl;
            continue;
        }
        Line l1 = Line(0,1,-b), l2 = Line(1,0,-a), l3 = Line(1,-4,0);
        Point p;
        bool tmp = intersect(l1,l3,p);
        double x;
        if (cmp(p.x,(double)a) == 1) {
            tmp = intersect(l2,l3,p);
            x = (double)a*(double)b - p.x*p.y*0.5;
        }
        else x = p.x*p.y*0.5;
        printf("%.8lf\n",1.0-x/((2.0*(double)b)*(double)a));

    }
    return 0;
}


#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define sz(a) (int)a.size()
#define fs first
#define sc second

typedef long long ll;
typedef pair<int,int> ii;

const double EPS = 1e-7;

struct Point {
    double x, y;
    Point(double _x = 0.0, double _y = 0.0) {
        x = _x;
        y = _y;
    }
};

struct Line {
    double a, b, c;
    Line(double _a = 0.0, double _b = 0.0, double _c = 0.0) {
        a = _a;
        b = _b;
        c = _c;
    }
};

int cmp(double a, double b) {
    if (abs(a-b)<EPS) return 0;
    if (a-b > EPS) return 1;
    return -1;
}

bool isParalel(Line l1, Line l2) {
    return cmp(l1.a*l2.b,l1.b*l2.a)==0;
}

bool intersect(Line l1, Line l2, Point & p) {
    if (isParalel(l1,l2)) return false;
    double dx = l1.b*l2.c - l2.b*l1.c;
    double dy = l1.c*l2.a - l2.c*l1.a;
    double d =  l1.a*l2.b - l2.a*l1.b;
    p.x = dx/d, p.y = dy/d;
    return true;
}

int main() {
    //freopen("input.txt","r",stdin);
    int t; scanf("%d",&t);
    while (t--) {
        int a, b;
        scanf("%d%d",&a,&b);
        if (a==0||b==0) {
            cout << "1.00000000" << endl;
            continue;
        }
        Line l1 = Line(0,1,-b), l2 = Line(1,0,-a), l3 = Line(1,-4,0);
        Point p;
        bool tmp = intersect(l1,l3,p);
        double x;
        if (cmp(p.x,(double)a) == 1) {
            tmp = intersect(l2,l3,p);
            x = (double)a*(double)b - p.x*p.y*0.5;
        }
        else x = p.x*p.y*0.5;
        printf("%.8lf\n",1.0-x/((2.0*(double)b)*(double)a));

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <sstream>
#include <set>
#include <map>
#include <bitset>
#include <deque>
#include <stack>

using namespace std;

#define INF 2139062143
#define LINF 9187201950435737471
#define mem(a,v) memset(a,v,sizeof(a))
#define maxn 200005
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define red(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define eps 1e-7
#define ll long long
#define mp make_pair
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
typedef pair<int,int> pp;

int main() {
    ios::sync_with_stdio(false);cout.setf(ios::fixed);cout.precision(20);
#ifdef LOCAL
    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/input.txt", "r", stdin);
//    freopen("input.txt", "r",stdin);
//    freopen("output.txt", "w",stdout);
#endif
    int T;
    cin>>T;
    while(T--)
    {
        double a,b;
        cin>>a>>b;
        double y = a/4;
        if(y<b+eps)
        {
            cout<<0.5+a/b/16<<'\n';
        }
        else
        {
            double x = 4*b;
            cout<<0.5+(2*a-x)/4/b<<'\n';
        }
    }

#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <sstream>
#include <set>
#include <map>
#include <bitset>
#include <deque>
#include <stack>

using namespace std;

#define INF 2139062143
#define LINF 9187201950435737471
#define mem(a,v) memset(a,v,sizeof(a))
#define maxn 200005
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define red(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define eps 1e-7
#define ll long long
#define mp make_pair
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
typedef pair<int,int> pp;

int main() {
    ios::sync_with_stdio(false);cout.setf(ios::fixed);cout.precision(20);
#ifdef LOCAL
    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/input.txt", "r", stdin);
//    freopen("input.txt", "r",stdin);
//    freopen("output.txt", "w",stdout);
#endif
    int T;
    cin>>T;
    while(T--)
    {
        double a,b;
        cin>>a>>b;
        double y = a/4;
        if(y<b+eps)
        {
            cout<<0.5+a/b/16<<'\n';
        }
        else
        {
            double x = 4*b;
            cout<<0.5+(2*a-x)/4/a<<'\n';
        }
    }

#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <sstream>
#include <set>
#include <map>
#include <bitset>
#include <deque>
#include <stack>

using namespace std;

#define INF 2139062143
#define LINF 9187201950435737471
#define mem(a,v) memset(a,v,sizeof(a))
#define maxn 200005
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define red(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define eps 1e-7
#define ll long long
#define mp make_pair
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
typedef pair<int,int> pp;

int main() {
    ios::sync_with_stdio(false);cout.setf(ios::fixed);cout.precision(20);
#ifdef LOCAL
    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/input.txt", "r", stdin);
//    freopen("input.txt", "r",stdin);
//    freopen("output.txt", "w",stdout);
#endif
    int T;
    cin>>T;
    while(T--)
    {
        double a,b;
        cin>>a>>b;
        if(fabs(b)<eps)
        {
            cout<<1<<"\n";
            continue;
        }
        if(fabs(a)<eps)
        {
            cout<<0<<'\n';
            continue;
        }
        double y = a/4;
        if(y<b+eps)
        {
            cout<<0.5+a/b/16<<'\n';
        }
        else
        {
            double x = 4*b;
            cout<<0.5+(2*a-x)/4/a<<'\n';
        }
    }

#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <sstream>
#include <set>
#include <map>
#include <bitset>
#include <deque>
#include <stack>

using namespace std;

#define INF 2139062143
#define LINF 9187201950435737471
#define mem(a,v) memset(a,v,sizeof(a))
#define maxn 200005
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define red(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define eps 1e-7
#define ll long long
#define mp make_pair
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
typedef pair<int,int> pp;

int main() {
    ios::sync_with_stdio(false);cout.setf(ios::fixed);cout.precision(20);
#ifdef LOCAL
    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/input.txt", "r", stdin);
//    freopen("input.txt", "r",stdin);
//    freopen("output.txt", "w",stdout);
#endif
    int T;
    cin>>T;
    while(T--)
    {
        double a,b;
        cin>>a>>b;
        if(fabs(b)<eps)
        {
            cout<<1<<"\n";
            continue;
        }
        double y = a/4;
        if(y<b+eps)
        {
            cout<<0.5+a/b/16<<'\n';
        }
        else
        {
            double x = 4*b;
            cout<<0.5+(2*a-x)/4/a<<'\n';
        }
    }

#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 			acos(-1)
#define mp			make_pair
#define pb			push_back
#define all(a)		(a).begin(), (a).end()
#define srt(a)			sort(all(a))
#define mem(a, h)	memset(a, (h), sizeof(a))
#define f 			first
#define s 			second
#define MOD			1000000007
#define MOD1		998244353
#define EPS			1e-9
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n;
	cin>>n;
	double a,b,dif;
	while(n--)
	{
		cin>>a>>b;
		if(b == 0)
		{
			cout<<"1\n";
			continue;
		}
		if(b*4.0 >=a)
			cout<<fixed<<setprecision(9)<<0.5 + (a/8.0)/(2.0*b)<<'\n';
		else
			cout<<fixed<<setprecision(9)<<(b*4.0)*0.75/a + (a-b*4.0)/(a)<<'\n';
	}
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 			acos(-1)
#define mp			make_pair
#define pb			push_back
#define all(a)		(a).begin(), (a).end()
#define srt(a)			sort(all(a))
#define mem(a, h)	memset(a, (h), sizeof(a))
#define f 			first
#define s 			second
#define MOD			1000000007
#define MOD1		998244353
#define EPS			1e-9
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n;
	cin>>n;
	double a,b;
	while(n--)
	{
		cin>>a>>b;
		cout<<fixed<<setprecision(9)<<0.5 + a/(16.0*b)<<'\n';
	}
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 			acos(-1)
#define mp			make_pair
#define pb			push_back
#define all(a)		(a).begin(), (a).end()
#define srt(a)			sort(all(a))
#define mem(a, h)	memset(a, (h), sizeof(a))
#define f 			first
#define s 			second
#define MOD			1000000007
#define MOD1		998244353
#define EPS			1e-9
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n;
	cin>>n;
	double a,b,dif;
	while(n--)
	{
		cin>>a>>b;
		if(b == 0)
			cout<<"1\n";
		if(b*4.0 >=a)
			cout<<fixed<<setprecision(9)<<0.5 + (a/8.0)/(2.0*b)<<'\n';
		else
			cout<<fixed<<setprecision(9)<<(b*4.0)*0.75/a + (a-b*4.0)/(a)<<'\n';
	}
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 			acos(-1)
#define mp			make_pair
#define pb			push_back
#define all(a)		(a).begin(), (a).end()
#define srt(a)			sort(all(a))
#define mem(a, h)	memset(a, (h), sizeof(a))
#define f 			first
#define s 			second
#define MOD			1000000007
#define MOD1		998244353
#define EPS			1e-9
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n;
	cin>>n;
	double a,b,dif;
	while(n--)
	{
		cin>>a>>b;
		if(b == 0)
			cout<<"0\n";
		if(b*4.0 >=a)
			cout<<fixed<<setprecision(9)<<0.5 + (a/8.0)/(2.0*b)<<'\n';
		else
			cout<<fixed<<setprecision(9)<<(b*4.0)*0.75/a + (a-b*4.0)/(a)<<'\n';
	}
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 			acos(-1)
#define mp			make_pair
#define pb			push_back
#define all(a)		(a).begin(), (a).end()
#define srt(a)			sort(all(a))
#define mem(a, h)	memset(a, (h), sizeof(a))
#define f 			first
#define s 			second
#define MOD			1000000007
#define MOD1		998244353
#define EPS			1e-9
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n;
	cin>>n;
	double a,b;
	while(n--)
	{
		cin>>a>>b;
		if(b == 0)
			cout<<"0\n";
		cout<<fixed<<setprecision(9)<<0.5 + min(a,b*4.0)/(16.0*b)<<'\n';
	}
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 			acos(-1)
#define mp			make_pair
#define pb			push_back
#define all(a)		(a).begin(), (a).end()
#define srt(a)			sort(all(a))
#define mem(a, h)	memset(a, (h), sizeof(a))
#define f 			first
#define s 			second
#define MOD			1000000007
#define MOD1		998244353
#define EPS			1e-9
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n;
	cin>>n;
	double a,b;
	while(n--)
	{
		cin>>a>>b;
		cout<<fixed<<setprecision(9)<<0.5 + max(a,b*4.0)/(16.0*b)<<'\n';
	}
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e20;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b;
        int a11  , b11;
        cin >> a >> b;
        a11 = a , b11 = b;
        if(b11 == 0){
            cout <<"1.0000000\n";
            continue;
        }
         if(a11 == 0){
            cout <<"0.5000000\n";
            continue;
        }
        double a1 = 2* b * a;
        double a2 = a*b;
        if(4*b11 >= a11){
         b = a / 4.0;
         a2 +=(0.5 * a * b);
        }
        else {
            a2+=( 2* b * b + (a - 4*b) *b);
        }
        a1 = a2 / (a1 *1.0);
        printf("%.10lf\n", a1);
    }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
   // init();
    solve();
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e20;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b , add = 0 , dif = 0.0;
        cin >> a >> b;
        if(a == 0){
            cout <<"0.00000\n";
            return;
        }
        else if(b == 0){
            cout <<"1.00000\n";
            return;
        }
        a = a/4.0;
        double a1 = a * c;
        if(a > b){
            dif  = a -b;
            dif = dif * c;
        }
        a = min(a , b);
        a=a*c;
        b=b*c;
        double ans = a *(a + 1);
        ans = ans / (2.0 *a * b);
        ans = ans / 2.0;
        ans = ans + 0.5;
        if(dif > 0){
            ans = ans * (a / a1) + (dif / a1)  ;
        }
        printf("%.10lf\n", ans);

        }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
    init();
    solve();
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e20;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b , add = 0 , dif = 0.0;
        cin >> a >> b;
        a = a/4.0;
        double a1 = a * c;
        if(a > b){
            dif  = a -b;
            dif = dif * c;
        }
        a = min(a , b);
        a=a*c;
        b=b*c;
        double ans = a *(a + 1);
        ans = ans / (2.0 *a * b);
        ans = ans / 2.0;
        ans = ans + 0.5;
        if(dif > 0){
            ans = ans * (a / a1) + (dif / a1)  ;
        }
        printf("%.10lf\n", ans);

        }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
    init();
    solve();
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e20;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b , add = 0 , dif = 0.0;
        cin >> a >> b;
        if(b == 0){
            cout <<"1.00000\n";
            return;
        }
        else if(a == 0){
            cout <<"0.00000\n";
            return;
        }
        a = a/4.0;
        double a1 = a * c;
        if(a > b){
            dif  = a -b;
            dif = dif * c;
        }
        a = min(a , b);
        a=a*c;
        b=b*c;
        double ans = a *(a + 1);
        ans = ans / (2.0 *a * b);
        ans = ans / 2.0;
        ans = ans + 0.5;
        if(dif > 0){
            ans = ans * (a / a1) + (dif / a1)  ;
        }
        printf("%.10lf\n", ans);

        }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
    init();
    solve();
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e20;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b , add = 0 , dif = 0.0;
        cin >> a >> b;
        if(b == 0){
            cout <<"1.00000\n";
            return;
        }
        else if(a == 0){
            cout <<"0.50000\n";
            return;
        }
        a = a/4.0;
        double a1 = a * c;
        if(a > b){
            dif  = a -b;
            dif = dif * c;
        }
        a = min(a , b);
        a=a*c;
        b=b*c;
        double ans = a *(a + 1);
        ans = ans / (2.0 *a * b);
        ans = ans / 2.0;
        ans = ans + 0.5;
        if(dif > 0){
            ans = ans * (a / a1) + (dif / a1)  ;
        }
        printf("%.10lf\n", ans);

        }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
    init();
    solve();
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e7;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b;
        cin >> a >> b;
        a = a/4.0;
        a=a*c;
        b=b*c;
        double ans = a *(a + 1);
        ans = ans / (2.0 *a * b);
        ans = ans / 2.0;
        ans = ans + 0.5;
        printf("%.10lf\n", ans);

        }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
    init();
    solve();
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e20;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b , add = 0 , dif = 0.0;
        cin >> a >> b;
        if(b == 0){
            cout <<"1.00000\n";
            return;
        }
        else if(a == 0){
            cout <<"0.50000\n";
            return;
        }
        double a1 = 2* b * a;
        double a2 = a*b;
        if(a > 4*b)
        a = min(a , 4*b);
        else
        b = min(b , a/4.0);
         a2 +=(0.5 * a * b);
        a1 = a2 / (a1 *1.0);
        printf("%.10lf\n", a1);
    }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
    init();
    solve();
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e20;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b;
        cin >> a >> b;
        a = a/4.0;
        a=a*c;
        b=b*c;
        double ans = a *(a + 1);
        ans = ans / (2.0 *a * b);
        ans = ans / 2.0;
        ans = ans + 0.5;
        printf("%.10lf\n", ans);

        }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
    init();
    solve();
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e20;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b;
        cin >> a >> b;
        if(b == 0){
            cout <<"1.0000000\n";
            return;
        }
        else if(a == 0){
            cout <<"0.5000000\n";
            return;
        }
        double a1 = 2* b * a;
        double a2 = a*b;
        if(4*b > a){
         b = a / 4.0;
         a2 +=(0.5 * a * b);
        }
        else {
            a2+=(0.5 * b * 4*b + (a - 4*b) *b);
        }
        a1 = a2 / (a1 *1.0);
        printf("%.10lf\n", a1);
    }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
    init();
    solve();
    return 0;
}


#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<deque>
#include<map>
#include<set>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
#define LL long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf("%c",&x)
#define sl(x) scanf("%I64d",&x)
#define all(x) x.begin(),x.end()
#define compress(x) {sort(all(x));(x).resize(unique(all(x))-(x).begin());}
template<class T> inline void umax(T &a,T b){if(a<b) a = b ;}
typedef pair<int, int> ii;
typedef pair<LL, LL> PII;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
#define vl vector<>
#define vi vector<int>
#define vii vector<ii>
#define vvl vector< vl >
#define vvi vector< vi >
#define vvii vector< vii >
#define sz size()
#define pb push_back
#define F first
#define S second
#define mem(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repv(i,b,a) for(int i=(b);i>=(a);i--)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PDD pair<LL, LL>
#define LLD long double

const int maxn = 5000 + 2;
const int INF  = 1e9 + 7;
//const LL INF = 0x0123456789ABCDEFLL;
const double c = 1e20;
inline void solve(void){
        int t;
        cin >> t;
        while(t--){
        double a, b;
        cin >> a >> b;
        if(b == 0){
            cout <<"1.0000000\n";
            continue;
        }
        else if(a == 0){
            cout <<"0.5000000\n";
            continue;
        }
        double a1 = 2* b * a;
        double a2 = a*b;
        if(4*b > a){
         b = a / 4.0;
         a2 +=(0.5 * a * b);
        }
        else {
            a2+=( 2* b * b + (a - 4*b) *b);
        }
        a1 = a2 / (a1 *1.0);
        printf("%.10lf\n", a1);
    }

}
void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main(int argc, const char * argv[]){
    //freopen("positive.in","r",stdin);
    //freopen("positive.out","w",stdout);
    init();
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int T;
double a,b;

int main() {
    cin >> T;
    while(T--) {
        cin >> a >> b;
        cout << setprecision(12) << (a*min(a/4,b) - 2*min(a/4,b)*min(a/4,b) + a*b)/(2*a*b) << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
int T;
double a,b;

int main() {
    cin >> T;
    while(T--) {
        cin >> a >> b;
        cout << setprecision(12) << a*min(a/4,b) - 2*min(a/4,b)*min(a/4,b) + a*b)/(2*a*b) << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
int T;
double a,b;

int main() {
    cin >> T;
    while(T--) {
        cin >> a >> b;
        if(!b) {
            cout << 1 << endl;
            continue;
        }
        if (!a) {
            cout << 0.5 << endl;
            continue;
        }
        cout << setprecision(12) << (a*min(a/4,b) - 2*min(a/4,b)*min(a/4,b) + a*b)/(2*a*b) << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
int T;
double a,b;

int main() {
    cin >> T;
    while(T--) {
        cin >> a >> b;
        if(!b) {
            cout << 1 << endl;
            continue;
        }
        cout << setprecision(12) << (a*min(a/4,b) - 2*min(a/4,b)*min(a/4,b) + a*b)/(2*a*b) << endl;
    }
}


/**Bismillahir Rahmanir Rahim//fold  */
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000007
#define llinf 1000000000000000000LL
#define bug(args ...) { istringstream iss(string(#args)); cout<<__LINE__<<": ", err(iss, args), cout << '\n'; }
void err(istringstream &iss) {}
template<typename T, typename ... Args> void err(istringstream &iss, const T &varVal, const Args & ... args) {
    string varName; iss >> varName; if (varName.back()==',') varName.back() = ' ';
    cout << varName << " = " << varVal << "; ", err(iss, args ...);
}
typedef long long int ll; typedef unsigned long long int ull;
int n, m, K, T, Q, cn;//end
#define mxn 100005

int a, b;

int main() { cin.tie(NULL);

// It will have a real root if p>=4q, now it's easy to see that for half of the range (-b, b) of q it's gonna happen for
// sure. Also, if 4b>a, for some part it's not gonna happen for sure (if 4b>=a answer will be 0.5+(a/16b) which can be
// seen from samples. If 4b<a then also for some part of a, the answer will be true always. From sample tests, when 2
// ranges are equal answer is probability of that range / 2.
    scanf("%d", &T);
    while (cn++!=T) {
        scanf("%d%d", &a, &b);
        if (4*b>=a) { printf("%.8f\n", 0.5+a/(16.0*b)); continue; }
        printf("%.8f\n", 0.5+(a-4*b)/(1.0*a)+(4*b)/(2.0*a));
    }

    return 0;
}


/**Bismillahir Rahmanir Rahim//fold  */
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000007
#define llinf 1000000000000000000LL
#define bug(args ...) { istringstream iss(string(#args)); cout<<__LINE__<<": ", err(iss, args), cout << '\n'; }
void err(istringstream &iss) {}
template<typename T, typename ... Args> void err(istringstream &iss, const T &varVal, const Args & ... args) {
    string varName; iss >> varName; if (varName.back()==',') varName.back() = ' ';
    cout << varName << " = " << varVal << "; ", err(iss, args ...);
}
typedef long long int ll; typedef unsigned long long int ull;
int n, m, K, T, Q, cn;//end
#define mxn 100005

int a, b;

int main() { cin.tie(NULL);

// It will have a real root if p>=4q, now it's easy to see that for half of the range (-b, b) of q it's gonna happen for
// sure. Also, if 4b>a, for some part it's not gonna happen for sure (if 4b>=a answer will be 0.5+(a/16b) which can be
// seen from samples. If 4b<a then also for some part of a, the answer will be true always. From sample tests, when 2
// ranges are equal answer is multiply of probability of those range / 2.
    scanf("%d", &T);
    while (cn++!=T) {
        scanf("%d%d", &a, &b);
        if (4*b>=a) { printf("%.8f\n", 0.5+a/(16.0*b)); continue; }
        printf("%.8f\n", 0.5+0.5*((a-4*b)/(1.0*a)+(4*b)/(2.0*a)));
    }

    return 0;
}


/**Bismillahir Rahmanir Rahim//fold  */
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000007
#define llinf 1000000000000000000LL
#define bug(args ...) { istringstream iss(string(#args)); cout<<__LINE__<<": ", err(iss, args), cout << '\n'; }
void err(istringstream &iss) {}
template<typename T, typename ... Args> void err(istringstream &iss, const T &varVal, const Args & ... args) {
    string varName; iss >> varName; if (varName.back()==',') varName.back() = ' ';
    cout << varName << " = " << varVal << "; ", err(iss, args ...);
}
typedef long long int ll; typedef unsigned long long int ull;
int n, m, K, T, Q, cn;//end
#define mxn 100005

int a, b;

int main() { cin.tie(NULL);

// It will have a real root if p>=4q, now it's easy to see that for half of the range (-b, b) of q it's gonna happen for
// sure. Also, if 4b>a, for some part it's not gonna happen for sure (if 4b>=a answer will be 0.5+(a/16b) which can be
// seen from samples. If 4b<a then also for some part of a, the answer will be true always. From sample tests, when 2
// ranges are equal answer is multiply of probability of those range / 2.
    scanf("%d", &T);
    while (cn++!=T) {
        scanf("%d%d", &a, &b);
        if (4*b>=a) printf("%.8f\n", b ? 0.5+a/(16.0*b) : 1);
        else printf("%.8f\n", 0.5+0.5*((a-4*b)/(1.0*a)+(4*b)/(2.0*a)));
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define INPUT freopen("B.inp","r",stdin)
#define OUTPUT freopen("B.out","w",stdout)
#define FOR(i,l,r) for(auto i=l;i<=r;i++)
#define REP(i,l,r) for(auto i=l;i<r;i++)
#define FORD(i,l,r) for(auto i=l;i>=r;i--)
#define REPD(i,l,r) for(auto i=l;i>r;i--)
#define ENDL printf("\n")
#define debug 1

typedef long long ll;
typedef pair<int,int> ii;

const int inf=1e9;
const int MOD=1e9+7;
const int N=0;

double solve(int x,int y){
    if (!y) return 1.0;
    if (x>4*y) return (x-4*y+.0)/x+solve(4*y,y);
    return (x+.0)/(y*16)+0.5;
}
int main(){
    int test,x,y;
    cin>>test;
    while (test--){
        cin>>x>>y;
        printf("%.9f\n",solve(x,y));
    }
}


#include <bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define INPUT freopen("B.inp","r",stdin)
#define OUTPUT freopen("B.out","w",stdout)
#define FOR(i,l,r) for(auto i=l;i<=r;i++)
#define REP(i,l,r) for(auto i=l;i<r;i++)
#define FORD(i,l,r) for(auto i=l;i>=r;i--)
#define REPD(i,l,r) for(auto i=l;i>r;i--)
#define ENDL printf("\n")
#define debug 1

typedef long long ll;
typedef pair<int,int> ii;

const int inf=1e9;
const int MOD=1e9+7;
const int N=0;

double solve(int x,int y){
    if (!y) return 1;
    if (x>4*y) return (x-4*y+.0)/x+solve(4*y,y);
    return (x+.0)/(y*16)+0.5;
}
int main(){
    int test,x,y;
    cin>>test;
    while (test--){
        cin>>x>>y;
        printf("%.9f\n",solve(x,y));
    }
}


#include <bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define INPUT freopen("B.inp","r",stdin)
#define OUTPUT freopen("B.out","w",stdout)
#define FOR(i,l,r) for(auto i=l;i<=r;i++)
#define REP(i,l,r) for(auto i=l;i<r;i++)
#define FORD(i,l,r) for(auto i=l;i>=r;i--)
#define REPD(i,l,r) for(auto i=l;i>r;i--)
#define ENDL printf("\n")
#define debug 1

typedef long long ll;
typedef pair<int,int> ii;

const int inf=1e9;
const int MOD=1e9+7;
const int N=0;

double solve(int x,int y){
    if (x>4*y) return (x-4*y+.0)/x+solve(4*y,y);
    return (x+.0)/(y*16)+0.5;
}
int main(){
    int test,x,y;
    cin>>test;
    while (test--){
        cin>>x>>y;
        printf("%.9f\n",solve(x,y));
    }
}


#include <bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define INPUT freopen("B.inp","r",stdin)
#define OUTPUT freopen("B.out","w",stdout)
#define FOR(i,l,r) for(auto i=l;i<=r;i++)
#define REP(i,l,r) for(auto i=l;i<r;i++)
#define FORD(i,l,r) for(auto i=l;i>=r;i--)
#define REPD(i,l,r) for(auto i=l;i>r;i--)
#define ENDL printf("\n")
#define debug 1

typedef long long ll;
typedef pair<int,int> ii;

const int inf=1e9;
const int MOD=1e9+7;
const int N=0;

double solve(int x,int y){
    if (!y) return 1.0;
    if (x>4*y) return 1.0-(y+.0)/x;
    return (x+.0)/(y*16)+0.5;
}
int main(){
    int test,x,y;
    cin>>test;
    while (test--){
        cin>>x>>y;
        printf("%.9f\n",solve(x,y));
    }
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
const double eps = 1e-15;
int t;
double a,b;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		double S = 2.0*b*a;
		double s;
		if(fabs(b/a - 0.25) >= eps){
			s = S - 2.0*b*b;
		}
		else s = a*b + a*a/8;
	 printf("%.11lf\n",s/S);
	}
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
const double eps = 1e-11;
int t;
double a,b;
int main(){
	cin>>t;
	while(t--){
		scanf("%lf%lf",&a,&b);
		if( b == 0)
			printf("1\n");
		else if(4*b >= a){
			printf("%.10f\n",0.5+a/(b*16.0));
		}
		else printf("%.10f\n",1-1.0*b/(a));
	}
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
const double eps = 1e-15;
int t;
double a,b;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		double S = 2.0*b*a;
		double s;
		if(fabs(b/a - 0.25) <= eps){
			s = S - 2.0*b*b;
		}
		else s = a*b + a*a/8;
	 printf("%.11lf\n",s/S);
	}
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
int t;
double a,b;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		double S = 2.0*b*a;
		double s;
		if(b/a >= 4){
			s = S - 2.0*b*b;
		}
		else s = a*b + a*a/8;
	 printf("%.9lf\n",s/S);
	}
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
int t;
double a,b;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		double S = 2.0*b*a;
		double s;
		if(b/a <= 0.25){
			s = S - 2.0*b*b;
		}
		else s = a*b + a*a/8;
	 printf("%.11lf\n",s/S);
	}
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
int t;
double a,b;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		double S = 2.0*b*a;
		double s;
		if(b/a <= 0.25){
			s = S - 2.0*b*b;
		}
		else s = a*b + a*a/8;
	 printf("%.9lf\n",s/S);
	}
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
const double eps = 1e-11;
int t;
double a,b;
int main(){
	cin>>t;
	while(t--){
		scanf("%lf%lf",&a,&b);
		double S = 2.0*b*a;
		double s;
		if(fabs(b/a - 0.25) <= eps || b/a <= 0.25){
			s = S - 2.0*b*b;
		}
		else s = a*b + a*a/8;
	 printf("%.11lf\n",s/S);
	}
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
const double eps = 1e-15;
int t;
double a,b;
int main(){
	cin>>t;
	while(t--){
		cin>>a>>b;
		double S = 2.0*b*a;
		double s;
		if(fabs(b/a - 0.25) <= eps || b/a <= 0.25){
			s = S - 2.0*b*b;
		}
		else s = a*b + a*a/8;
	 printf("%.11lf\n",s/S);
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define For(i,a,b) for(int i=a-1;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define Rep(i,b) For(i,a,0)
#define SORT(x) sort(x.begin(),x.end());
#define ERASE(x) x.erase(x.begin(),x.end());
#define FILL(x,i) memset(x,i,sizeof(x));
#define K 1000000007
#define L 400
#define s1(a) scanf("%d",&a);
#define s2(a) scanf("%lld",&a);
#define s3(a,b) scanf("%lld%lld",&a,&b);
#define s4(a,b,c) scanf("%lld%lld%lld",&a,&b,&c);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define EPS 0.000001
#define MAX 1

typedef long long int ll;

bool cmp(ll a,ll b){if(a>b) return true; return false;}

ll powr(int s,int p)
{
	if(p==0)
		return 1;

	if(p%2==1)
	{
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		q=(q*s);
		return ( q );
	}

	else
	{
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		return (q);
	}
}
/*******************************MAIN CODE STARTS*******************************/

int main()
{
	int t=1;
	//s1(t)
	while(t--)
	{
		int a, b;
    	scanf("%d %d", &a, &b);
    	double ret;
    	if (b == 0)
    	{
    		ret = 1.0;
    	}
    	else if (a < 4 * b)
    	{
      	ret = 0.5 + a / 16.0 / b;
    	}
    	else
    	{
      	ret = (double)(a - b) / a;
    	}
    	printf("%.9lf\n", ret);
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define For(i,a,b) for(int i=a-1;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define Rep(i,b) For(i,a,0)
#define SORT(x) sort(x.begin(),x.end());
#define ERASE(x) x.erase(x.begin(),x.end());
#define FILL(x,i) memset(x,i,sizeof(x));
#define K 1000000007
#define L 400
#define s1(a) scanf("%d",&a);
#define s2(a) scanf("%lld",&a);
#define s3(a,b) scanf("%lld%lld",&a,&b);
#define s4(a,b,c) scanf("%lld%lld%lld",&a,&b,&c);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define EPS 0.000001
#define MAX 1

typedef long long int ll;

bool cmp(ll a,ll b){if(a>b) return true; return false;}

ll powr(int s,int p) {
	if(p==0)
		return 1;

	if(p%2==1) {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		q=(q*s);
		return ( q );
	}

	else {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		return (q);
	}
}
/*******************************MAIN CODE STARTS*******************************/

long double a,b,res;

int main() {
	int t=1;
	s1(t)
	while(t--) {
		cin>>a>>b;
		if(abs(a-0)<=EPS) {
			res = 0.5;
		}
		else if(abs(b-0)>EPS) {
			if(4*b>=a) {
 				res = ((2*b + a*0.25)/2.0)*a;
				res = res/(2.0*a*b);
			} else {
				res = (2.0*a*b)-(2.0*b*b);
				res = res/(2.0*a*b);
			}
		} else {
			res = 1.0;
		}
		cout<<fixed<<setprecision(7)<<res<<'\n';
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define For(i,a,b) for(int i=a-1;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define Rep(i,b) For(i,a,0)
#define SORT(x) sort(x.begin(),x.end());
#define ERASE(x) x.erase(x.begin(),x.end());
#define FILL(x,i) memset(x,i,sizeof(x));
#define K 1000000007
#define L 400
#define s1(a) scanf("%d",&a);
#define s2(a) scanf("%lld",&a);
#define s3(a,b) scanf("%lld%lld",&a,&b);
#define s4(a,b,c) scanf("%lld%lld%lld",&a,&b,&c);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define EPS 0.00000000000001
#define MAX 1

typedef long long int ll;

bool cmp(ll a,ll b){if(a>b) return true; return false;}

ll powr(int s,int p) {
	if(p==0)
		return 1;

	if(p%2==1) {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		q=(q*s);
		return ( q );
	}

	else {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		return (q);
	}
}
/*******************************MAIN CODE STARTS*******************************/

double a,b,res;

int main() {
	int t=1;
	s1(t)
	while(t--) {
		cin>>a>>b;
		if(abs(a-0.0)<=EPS) {
			res = 0.5;
		} else if(abs(b-0.0)<=EPS) {
			res = 1.0;
		} else {
			if(4*b>=a) {
 				res = ((2*b + a*0.25)/2.0)*a;
				res = res/(2.0*a*b);
			} else {
				res = (2.0*a*b)-(2.0*b*b);
				res = res/(2.0*a*b);
			}
		}
		printf("%.10lf\n",res);
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define For(i,a,b) for(int i=a-1;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define Rep(i,b) For(i,a,0)
#define SORT(x) sort(x.begin(),x.end());
#define ERASE(x) x.erase(x.begin(),x.end());
#define FILL(x,i) memset(x,i,sizeof(x));
#define K 1000000007
#define L 400
#define s1(a) scanf("%d",&a);
#define s2(a) scanf("%lld",&a);
#define s3(a,b) scanf("%lld%lld",&a,&b);
#define s4(a,b,c) scanf("%lld%lld%lld",&a,&b,&c);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define EPS 0.000001
#define MAX 1

typedef long long int ll;

bool cmp(ll a,ll b){if(a>b) return true; return false;}

ll powr(int s,int p) {
	if(p==0)
		return 1;

	if(p%2==1) {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		q=(q*s);
		return ( q );
	}

	else {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		return (q);
	}
}
/*******************************MAIN CODE STARTS*******************************/

long double a,b,res;

int main() {
	int t=1;
	s1(t)
	while(t--) {
		cin>>a>>b;
		if(abs(a-0)<=EPS) {
			res = 0.5;
		}
		else if(abs(b-0)>EPS) {
			if(4*b>=a) {
 				res = ((2*b + min((a/4.0),b))/2.0)*a;
				res = res/(2.0*a*b);
			} else {
				res = (2.0*a*b)-(2.0*b*b);
				res = res/(2.0*a*b);
			}
		} else {
			res = 1.0;
		}
		cout<<fixed<<setprecision(10)<<res<<'\n';
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define For(i,a,b) for(int i=a-1;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define Rep(i,b) For(i,a,0)
#define SORT(x) sort(x.begin(),x.end());
#define ERASE(x) x.erase(x.begin(),x.end());
#define FILL(x,i) memset(x,i,sizeof(x));
#define K 1000000007
#define L 400
#define s1(a) scanf("%d",&a);
#define s2(a) scanf("%lld",&a);
#define s3(a,b) scanf("%lld%lld",&a,&b);
#define s4(a,b,c) scanf("%lld%lld%lld",&a,&b,&c);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define EPS 0.000001
#define MAX 1

typedef long long int ll;

bool cmp(ll a,ll b){if(a>b) return true; return false;}

ll powr(int s,int p) {
	if(p==0)
		return 1;

	if(p%2==1) {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		q=(q*s);
		return ( q );
	}

	else {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		return (q);
	}
}
/*******************************MAIN CODE STARTS*******************************/

long double a,b,res;

int main() {
	int t=1;
	s1(t)
	while(t--) {
		cin>>a>>b;
		if(abs(b-0)>EPS) {
 			res = ((2*b + min((a/4.0),b))/2.0)*a;
			res = res/(2.0*a*b);
		} else {
			res = 1.0;
		}
		cout<<fixed<<setprecision(10)<<res<<'\n';
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define For(i,a,b) for(int i=a-1;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define Rep(i,b) For(i,a,0)
#define SORT(x) sort(x.begin(),x.end());
#define ERASE(x) x.erase(x.begin(),x.end());
#define FILL(x,i) memset(x,i,sizeof(x));
#define K 1000000007
#define L 400
#define s1(a) scanf("%d",&a);
#define s2(a) scanf("%lld",&a);
#define s3(a,b) scanf("%lld%lld",&a,&b);
#define s4(a,b,c) scanf("%lld%lld%lld",&a,&b,&c);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define EPS 0.000001
#define MAX 1

typedef long long int ll;

bool cmp(ll a,ll b){if(a>b) return true; return false;}

ll powr(int s,int p)
{
	if(p==0)
		return 1;

	if(p%2==1)
	{
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		q=(q*s);
		return ( q );
	}

	else
	{
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		return (q);
	}
}
/*******************************MAIN CODE STARTS*******************************/

int main()
{
	int t=1;
	s1(t)
	while(t--)
	{
		int a, b;
    	scanf("%d %d", &a, &b);
    	double ret;
    	if (b == 0)
    	{
    		ret = 1.0;
    	}
    	else if (a < 4 * b)
    	{
      	ret = 0.5 + a / 16.0 / b;
    	}
    	else
    	{
      	ret = (double)(a - b) / a;
    	}
    	printf("%.9lf\n", ret);
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define For(i,a,b) for(int i=a-1;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define Rep(i,b) For(i,a,0)
#define SORT(x) sort(x.begin(),x.end());
#define ERASE(x) x.erase(x.begin(),x.end());
#define FILL(x,i) memset(x,i,sizeof(x));
#define K 1000000007
#define L 400
#define s1(a) scanf("%d",&a);
#define s2(a) scanf("%lld",&a);
#define s3(a,b) scanf("%lld%lld",&a,&b);
#define s4(a,b,c) scanf("%lld%lld%lld",&a,&b,&c);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define EPS 0.000001
#define MAX 1

typedef long long int ll;

bool cmp(ll a,ll b){if(a>b) return true; return false;}

ll powr(int s,int p) {
	if(p==0)
		return 1;

	if(p%2==1) {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		q=(q*s);
		return ( q );
	}

	else {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		return (q);
	}
}
/*******************************MAIN CODE STARTS*******************************/

long double a,b,res;

int main() {
	int t=1;
	s1(t)
	while(t--) {
		cin>>a>>b;
		if(abs(b-0)>EPS) {
			if(4*b>=a) {
 				res = ((2*b + min((a/4.0),b))/2.0)*a;
				res = res/(2.0*a*b);
			} else {
				res = (2.0*a*b)-(2.0*b*b);
				res = res/(2.0*a*b);
			}
		} else {
			res = 1.0;
		}
		cout<<fixed<<setprecision(10)<<res<<'\n';
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define For(i,a,b) for(int i=a-1;i>=b;i--)
#define rep(i,b) FOR(i,0,b)
#define Rep(i,b) For(i,a,0)
#define SORT(x) sort(x.begin(),x.end());
#define ERASE(x) x.erase(x.begin(),x.end());
#define FILL(x,i) memset(x,i,sizeof(x));
#define K 1000000007
#define L 400
#define s1(a) scanf("%d",&a);
#define s2(a) scanf("%lld",&a);
#define s3(a,b) scanf("%lld%lld",&a,&b);
#define s4(a,b,c) scanf("%lld%lld%lld",&a,&b,&c);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define EPS 0.000001
#define MAX 1

typedef long long int ll;

bool cmp(ll a,ll b){if(a>b) return true; return false;}

ll powr(int s,int p) {
	if(p==0)
		return 1;

	if(p%2==1) {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		q=(q*s);
		return ( q );
	}

	else {
		ll q=powr(s,p/2);
		ll a=q;
		q=(a*a);
		return (q);
	}
}
/*******************************MAIN CODE STARTS*******************************/

long double a,b;

int main() {
	int t=1;
	s1(t)
	while(t--) {
		cin>>a>>b;
		long double res = ((2*b + min((a/4),b))/2.0)*a;
		res = res/(2*a*b);
		cout<<fixed<<setprecision(10)<<res<<'\n';
	}
	return 0;
}


#include<iostream>
#include<map>
#include<string>
#include<string.h>
#include<vector>
#include<stdio.h>
#include <cstdio>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <functional>
#define LL long long int

#define ii pair< int,int >
#define iii pair< int , ii >
#define vi vector<int>

#define II pair< LL , LL >
#define III pair< LL  , LL >
#define vI vector<LL>

#define rI(B) scanf("%d",&B)
#define wI(B) printf("%d",B)

#define R(i) freopen(i,"r",stdin)
#define W(i) freopen(i,"w",stdout)
#define R_W R("i.txt"),W("o.txt");

#define FOR(i,f,t) for(int i=f;i<t;i++)
#define r(e) for(int i=0;i<e;i++)
#define OO (LL)numeric_limits<long long int>::max()
int oo = 2147483647;
using namespace std;
struct point {
	double x, y;
};
double solve(double a, double b) {
	if (b == 0) return 1;
	if (a == 0) return .5;
	if(a/4<=b) return .5+(a / 16.0 / b);
	return 1 - (b / a);
}
int main() {
	///R_W;
	int t;
	cin >> t;
	while (t--) {
		int a, b;
		cin >> a >> b;
		printf("%.9lf\n", solve(a, b));
	}
}


#include<iostream>
#include<map>
#include<string>
#include<string.h>
#include<vector>
#include<stdio.h>
#include <cstdio>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <functional>
#define LL long long int

#define ii pair< int,int >
#define iii pair< int , ii >
#define vi vector<int>

#define II pair< LL , LL >
#define III pair< LL  , LL >
#define vI vector<LL>

#define rI(B) scanf("%d",&B)
#define wI(B) printf("%d",B)

#define R(i) freopen(i,"r",stdin)
#define W(i) freopen(i,"w",stdout)
#define R_W R("i.txt"),W("o.txt");

#define FOR(i,f,t) for(int i=f;i<t;i++)
#define r(e) for(int i=0;i<e;i++)
#define OO (LL)numeric_limits<long long int>::max()
int oo = 2147483647;
using namespace std;
struct point {
	double x, y;
};
double solve(double a, double b) {
	if (a == 0) return .5;
	if (b == 0) return 1;
	return (a / 16.0 / b) + (1.0 / 2.0);
}
int main() {
	///R_W;
	int t;
	cin >> t;
	while (t--) {
		int a, b;
		cin >> a >> b;
		printf("%.9lf\n", solve(a, b));
	}
}


#include<iostream>
#include<map>
#include<string>
#include<string.h>
#include<vector>
#include<stdio.h>
#include <cstdio>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <functional>
#define LL long long int

#define ii pair< int,int >
#define iii pair< int , ii >
#define vi vector<int>

#define II pair< LL , LL >
#define III pair< LL  , LL >
#define vI vector<LL>

#define rI(B) scanf("%d",&B)
#define wI(B) printf("%d",B)

#define R(i) freopen(i,"r",stdin)
#define W(i) freopen(i,"w",stdout)
#define R_W R("i.txt"),W("o.txt");

#define FOR(i,f,t) for(int i=f;i<t;i++)
#define r(e) for(int i=0;i<e;i++)
#define OO (LL)numeric_limits<long long int>::max()
int oo = 2147483647;
using namespace std;
struct point {
	double x, y;
};
double solve(double a, double b) {
	if (a == 0) return .5;
	if (b == 0) return 1;
	if(a/4<=b) return .5+(a / 16.0 / b);
	return 1 - (b / a);
}
int main() {
	///R_W;
	int t;
	cin >> t;
	while (t--) {
		int a, b;
		cin >> a >> b;
		printf("%.9lf\n", solve(a, b));
	}
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a*(b/gcd(a,b));}
int main() {
	int i,j,k;
	int t;
	int n;
	cin>>t;
	while(t--){
		double a,b;
		double ans=0.5;
		cin>>a>>b;
		b*=4;
		if(a>=b){
			ans+=(a-b)/a;
		}
		else{
			a/=4;
			ans+=a/b;
		}
		printf("%0.10f\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a*(b/gcd(a,b));}
int main() {
	int i,j,k;
	int t;
	int n;
	cin>>t;
	while(t--){
		double a,b;
		long double ans=0.5;
		cin>>a>>b;
		if(a>4*b){
			ans=1.0-(b)/a;
		}
		else{
			a/=16;
			ans+=a/b;
		}
		printf("%0.10Lf\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a*(b/gcd(a,b));}
int main() {
	int i,j,k;
	int t;
	int n;
	cin>>t;
	while(t--){
		double a,b;
		double ans=0.5;
		cin>>a>>b;
		if(a-4*b>0.0){
			ans=1.0-(double)(b/a);
		}
		else{
			a/=16;
			ans+=a/b;
		}
		printf("%0.10f\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a*(b/gcd(a,b));}
int main() {
	int i,j,k;
	int t;
	int n;
	cin>>t;
	while(t--){
		double a,b;
		double ans=0.5;
		cin>>a>>b;
		b*=4;
		if(a>=b) ans+=0.5;
		else{
			a/=4;
			ans+=a/b;
		}
		printf("%0.10f\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a*(b/gcd(a,b));}
int main() {
	int i,j,k;
	int t;
	int n;
	cin>>t;
	while(t--){
		double a,b;
		double ans=0.5;
		cin>>a>>b;
		b*=4;
		if(a>b){
			ans+=0.5;
		}
		else{
			a/=4;
			ans+=a/b;
		}
		printf("%0.10f\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a*(b/gcd(a,b));}
int main() {
	int i,j,k;
	int t;
	int n;
	cin>>t;
	while(t--){
		double a,b;
		double ans=0.5;
		cin>>a>>b;
		b*=4;
		if(a>b){
			ans=(b-1)/a;
		}
		else{
			a/=4;
			ans+=a/b;
		}
		printf("%0.10f\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a*(b/gcd(a,b));}
int main() {
	int i,j,k;
	int t;
	int n;
	cin>>t;
	while(t--){
		double a,b;
		double ans=0.5;
		cin>>a>>b;
		if(a>4*b){
			ans=1.0-(b)/a;
		}
		else{
			a/=16;
			ans+=a/b;
		}
		printf("%0.10f\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repitr(itr,v) for (itr=v.begin();itr!=v.end();itr++)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define LL long long int
#define ULL unsigned long long int
#define vii vector<pair<int,int> >
#define mems(a,b) memset(a,b,sizeof(a))
ULL MOD=1000000007;
ULL B=13331;
bool cmp(const int &a,const int &b){
	return a<b;
}
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a*(b/gcd(a,b));}
int main() {
	int i,j,k;
	int t;
	int n;
	cin>>t;
	while(t--){
		double a,b;
		double ans=0.5;
		cin>>a>>b;
		if(a==0 || b==0){
			if(!a && !b) {
				cout<<1.0000000000<<endl;
				continue;
			}
			if(!a){
				cout<<0.5000000000<<endl;
				continue;
			}
			cout<<1.0000000000<<endl;
			continue;
		}
		if(a-4*b>0.0){
			ans=1.0-(double)(b/a);
		}
		else{
			a/=16;
			ans+=a/b;
		}
		printf("%0.10f\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 100005;
ll n, frm, num[N], digit[N];
vector <ll> edges[N];
void ser (ll last, ll u);
bool billt (ll num, ll feke);
int main () {
	scanf ("%lld", &n);
    for (int i = 1; i <= n; i ++) {
		scanf ("%lld", &num[i]);
		edges[i].clear();
	}
    for (int i = 1; i < n; i ++) {
    	ll u, v;
        scanf ("%lld %lld", &u, &v);
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    scanf ("%lld", &frm);
    ser(frm, frm);
    printf ("%lld", digit[frm] - 1);
    return 0;
}
bool billt (ll num, ll feke) {
	return num > feke;
}
void ser (ll u, ll last) {
    digit[u] = 1;
	vector <ll> s;
    for(ll i = 0; i < edges[u].size(); i++){
        ll v = edges[u][i];
		if (v == last || num[v] == 0)
			continue;
		num[v]--;
		ser(v, u);
        if (digit[v])
           s.push_back(digit[v]);
    }
	sort(s.begin(), s.end(),billt);
	for (ll i = 0; num[u] && i < s.size(); i ++) {
		num[u] --;
		digit[u] += s[i] + 1;
	}
    for (ll i = 0; num[u] && i < edges[u].size(); i ++) {
        ll v = edges[u][i]; if(v == last || num[v] == 0)continue;
        digit[u] += 2LL * min(num[u], num[v]);
        num[u] -= min(num[u], num[v]);
    }
    return ;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 100005;
ll n, frm, num[N], digit[N];
vector <ll> edges[N];
void ser (ll last, ll u);
bool billt (ll num, ll feke);
int main () {
	scanf ("%d", &n);
    for (int i = 1; i <= n; i ++) {
		scanf ("%d", &num[i]);
		edges[i].clear();
	}
    for (int i = 1; i < n; i ++) {
    	ll u, v;
        scanf ("%d %d", &u, &v);
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    scanf ("%d", &frm);
    ser(frm, frm);
    printf ("%d", digit[frm] - 1);
    return 0;
}
bool billt (ll num, ll feke) {
	return num > feke;
}
void ser (ll u, ll last) {
    digit[u] = 1;
	vector <ll> s;
    for(ll i = 0; i < edges[u].size(); i++){
        ll v = edges[u][i];
		if (v == last || num[v] == 0)
			continue;
		num[v]--;
		ser(v, u);
        if (digit[v])
           s.push_back(digit[v]);
    }
	sort(s.begin(), s.end(),billt);
	for (ll i = 0; num[u] && i < s.size(); i ++) {
		num[u] --;
		digit[u] += s[i] + 1;
	}
    for (ll i = 0; num[u] && i < edges[u].size(); i ++) {
        ll v = edges[u][i]; if(v == last || num[v] == 0)continue;
        digit[u] += 2LL * min(num[u], num[v]);
        num[u] -= min(num[u], num[v]);
    }
    return ;
}