#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

// #define int long long
#define int __int128
#define endl "\n"

constexpr int  INF = (int)1e35;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;


std::ostream& operator << (std::ostream& os, const __int128& in)
{
    constexpr __int32_t base = 10;
    bool sign = false;
    if(in < 0) sign = true;
    vector<__int32_t> num;
        
    for(__int128 i = in; i; i /= base){
        num.push_back(i % base);
    }
    
    if(num.size() == 0) num.push_back(0);
    
    if(sign) cout<<"-";
    
    for(__int32_t i = num.size()-1; i >= 0; i--){
        cout<<num[i];
    }
    
    // cout<<endl;
    
    return os;
}

std::istream& operator >> (std::istream& is, __int128& out)
{
    
    char c;
    out = 0;
    
    while(is.get(c) && isspace(c)) ;
    
    if(is){
        do out = out * 10 + c - '0';
        while(is.get(c) && !isspace(c));
        
        if(is) is.unget();
    }
    
    return is;
}

void extgcd(int a, int b, int &x, int &y){
	if(b == 0){
		x = 1;
		y = 0;
		return ;
	}
	extgcd(b,a%b,y,x);
	y -= a/b * x;
}

int mod_inverse(int a, int m){
	int x, y;
	extgcd(a, m, x, y);
	return (m + x % m ) % m;
}

int gcd(int a, int b) {return a%b?gcd(b, a%b):b;};

pair<int,int> liner_congruence(const vector<int>& A, const vector<int>& B, const vector<int>& M){
	
	int x = 0, m = 1;
	
	for(int i = 0; i < A.size(); i++){
		int a = A[i] * m, b = B[i] - A[i] * x, d = gcd(M[i], a);
		if(b % d != 0) return make_pair(0, -1);
		int t =  b / d * mod_inverse(a / d, M[i] / d) % (M[i] / d);
		x = x + m * t;
		m *= M[i] / d;
	}
	
	return make_pair((x%m + m) % m, m);
}


signed main(){
	cout<<fixed<<setprecision(10);
	
	int T;
    
    cin>>T;
    
    for(int _ = 0; _ < T; _++){
        int X, Y, P, Q;
        int mini = INF;
        vector<int> A(2), B(2), M(2);
        
        cin>>X>>Y>>P>>Q;
        
        M[0] = X * 2 + Y * 2;
        M[1] = P + Q;
        
        for(int i = 0; i < Y; i++){
            for(int j = 0; j < Q; j++){
                A[0] = 1;
                A[1] = 1;
                
                B[0] = (X + i);
                B[1] = (P + j);
                
                pair<int,int> p = liner_congruence(A, B, M);
                
                if(p.first != 0) {
                    mini = min(mini, p.first);
                }
            }
        }
        
        if(mini != INF)cout<<mini<<endl;
        else cout<<"infinity"<<endl;
    }
	
	
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

struct UnionFind {
    vector<int> par;
    vector<int> sz;

    UnionFind(int n=0){ if(n>0) initialize(n); }
    void initialize(int n){
        par.resize(n);
        sz.assign(n, 1);
        for(int i=0; i<n; i++){
            par[i] = i;
        }
    }

    int find(int x){
        if(par[x] == x){
            return x;
        }else{
            return par[x] = find(par[x]);
        }
    }

    bool unite(int x, int y){
        x = find(x), y = find(y);
        if(x == y) return false;
        if(sz[x] > sz[y]) swap(x, y);
        par[x] = y;
        sz[y] += sz[x];
        return true;
    }

    bool same(int x, int y){ return find(x) == find(y); }
    int size(int x){ return sz[find(x)]; }
};

int main(){
    int N;
    cin >> N;
    vector<double> X(N), Y(N);
    for(int i=0; i<N; i++) cin >> X[i] >> Y[i];

    using T = tuple<double, int, int>;
    vector<T> es;
    for(int i=0; i<N; i++) for(int j=0; j<i; j++) es.emplace_back(hypot(X[i]-X[j], Y[i]-Y[j]), i, j);
    for(int i=0; i<N; i++){
        es.emplace_back(100-Y[i], i, N);
        es.emplace_back(Y[i]+100, i, N+1);
    }
    sort(es.begin(), es.end());

    UnionFind uf(N+2);
    for(auto& [d, a, b] : es){
        uf.unite(a, b);
        if(uf.same(N, N+1)){
            cout << fixed << setprecision(10) << d/2 << endl;
            return 0;
        }
    }

    return 0;
}
