#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
typedef long long LL;
const LL inf = 2e18;
using namespace std;
int T, x, y, p, q;
LL ans;
LL gcd(LL a, LL b) {
    if (!b)
        return a;

    return gcd(b, a % b);
}
LL exgcd(LL a, LL b, LL &x, LL &y) {
    LL g = a;

    if (!b)
        x = 1, y = 0;
    else {
        g = exgcd(b, a % b, y, x);
        y -= a / b * x;
    }

    return g;
}
LL calc(LL a, LL b, LL A, LL B) {
    LL c = A - B;

    if (c % gcd(a, b) != 0)
        return inf;

    LL x = 0, y = 0;
    LL g = exgcd(a, b, x, y);
    x *= c / g;
    y *= c / g;
    LL ans = inf;
    LL p = ceil(1.0 * -B / a), q = ceil(1.0 * A / b);
    LL bb = b / g;
    LL t1 = ceil(1.0 * (p - x) / bb);
    x += t1 * bb;
    return x * a + B;
}
void dfs(int k)
{
	if(!k)return;
	int x=1;
	x++;
	dfs(k-1);
}
int main() {
    cin >> T;
    int ccc = 0;
    for (int i = 1;i <= T;i++)
        ccc++;
    while (T--) {
        cin >> x >> y >> p >> q;
        ans = inf;

        for (LL a = p; a < p + q; a++)
            for (LL b = x; b < x + y; b++) {
                ans = min(calc(2 * (x + y), (p + q), a, b), ans);
            }

        if (ans == inf)
            cout << "infinity" << endl;
        else
            cout << ans << endl;
    }
	dfs(1000);
    return 0;
}

#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

class UnionFind {
    int cnt;
    vector<int> par, rank, size;
public:
    UnionFind() {}
    UnionFind(int _n) :cnt(_n), par(_n), rank(_n), size(_n, 1) {
        for (int i = 0; i<_n; ++i) par[i] = i;
    }
    int find(int k) {
        return (k == par[k]) ? k : (par[k] = find(par[k]));
    }
    int operator[](int k) {
        return find(k);
    }
    int getSize(int k) {
        return size[find(k)];
    }
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return;
        --cnt;
        if (rank[x] < rank[y]) {
            par[x] = y;
            size[y] += size[x];
        } else {
            par[y] = x;
            size[x] += size[y];
            if (rank[y] == rank[x]) ++rank[x];
        }
    }
    int count() {
        return cnt;
    }
};

void solve() {
    int N;
    cin >> N;
    vi X(N), Y(N);
    rep(i, N) cin >> X[i] >> Y[i];
    double ng = 100, ok = 0;
    rep(ITER, 60) {
        UnionFind uf(N + 2);
        double r = (ng + ok) / 2;
        rep(i, N) {
            if (100 - Y[i] < 2 * r)uf.unite(i, N);
            if (Y[i] + 100 < 2 * r)uf.unite(i, N + 1);
            rep(j, i) {
                if (hypot(X[i] - X[j], Y[i] - Y[j]) < 2 * r) {
                    uf.unite(i, j);
                }
            }
        }
        (uf[N] == uf[N + 1] ? ng : ok) = r;
    }
    cout << ok << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}