#include <iostream>
#include <cmath>

using namespace std;

void rozwiaz_przypadek() {
    double L, dL;
    if (!(cin >> L >> dL)) return;

    double target = L / (L + dL);
    double low = 1e-12;
    double high = 3.14159265358979323846;

    for (int i = 0; i < 80; ++i) {
        double mid = low + (high - low) / 2.0;
        double val = sin(mid) / mid;
        if (val < target) {
            high = mid;
        } else {
            low = mid;
        }
    }

    double alpha = (low + high) / 2.0;
    double h = (L / 2.0) * tan(alpha / 2.0);
    cout << (long long)llround(h) << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    if (cin >> t) {
        while (t--) {
            rozwiaz_przypadek();
        }
    }

    return 0;
}