#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int t, n, H, S, V;
double a[10005], d;
int main()
{
    scanf("%d", &t);
    double ans;
    while (t--)
    {
        ans = 0;
        scanf("%d", &n);
        for (int i = 0; i < n; i++)
        {
            scanf("%lf%lf", a + i, &d);
            if (d >= 1)
                a[i] = a[i] * a[i] * a[i];
            else
                a[i] = a[i] * a[i] * a[i] * d;
        }
        scanf("%d%d%d", &S, &H, &V);
        ans += V / S;
        for (int i = 0; i < n; i++)
        {
            ans += a[i] / S;
            if (ans > H)
            {
                ans = H;
                break;
            }
        }
        printf("%.2lf\n", ans);
    }
    return 0;
}