#include <bits/stdc++.h>

using namespace std;

#define ar array
#define ll long long
typedef int uci;
#define int long long

//! function insert

uci main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int tc;
    cin >> tc;
    while(tc--){
        int n;
        cin >> n;

        vector<ar<int, 2>> a(n);
        for(int i{}; i < n; ++i)
            cin >> a[i][0] >> a[i][1];

        int run{};
        long double out{};
        int prev{};
        for(int i{}; i < n; ++i){
            if(a[i][0] >= 5280){
                int took = 5280 - run;

                long double ti = a[i][1] - prev;
                ti /= a[i][0] - run;

                out += took*ti;
                break;
            }else{
                out = a[i][1];
            }

            run = a[i][0];
            prev = a[i][1];
        }
        cout << setprecision(10) << fixed << out << '\n';
    }

}
