#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long N = 1234567891, M = 31, N2 = 1234567891;
long long x, y, z, i, j, n, m, k, l, r, t, ma = 0, ans, x2, y2, f, kol, mi,
                                           a[1110000], b[1110000], p[1110000],
                                           h[1110000];
string s, s2, s3;
vector<long long> v, v2, v3;
double ep = 1e-6;
double dp[1100][110], dp2[1100][110], d[1110000];
vector<pair<int, int> > ve;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    double tren, vrem;
    cin >> n >> tren >> vrem;
    int su = 0;
    ve.clear();
    for (i = 1; i <= n; i++) {
      cin >> a[i] >> b[i];
      ve.push_back(make_pair(a[i], b[i]));
      su += b[i];
    }
    sort(ve.begin(), ve.end());
    for (i = 1; i <= n; i++) {
      a[i] = ve[n - i].first;
      b[i] = ve[n - i].second;
    }
    d[0] = 1;
    for (i = 1; i <= n; i++) d[i] = d[i - 1] * 0.9;
    for (i = 0; i <= su; i++)
      for (j = 0; j <= n; j++) {
        dp[i][j] = (double)1e15;
      }
    dp[0][0] = 0.0;
    for (i = 1; i <= n; i++) {
      for (j = su - b[i]; j >= 0; j--) {
        for (k = 0; k < i; k++) {
          if (dp[j][k] > 1e14) continue;
          dp[j + b[i]][k + 1] = min(dp[j + b[i]][k + 1], dp[j][k] * 0.9 + a[i]);
        }
      }
    }
    ma = 0;
    for (i = 1; i <= su; i++)
      for (j = 1; j <= n; j++) {
        if (dp[i][j] > 1e14) continue;
        dp[i][j] /= d[j];
        double st = (1.0 * sqrt(dp[i][j] * tren) - 1) / tren;
        st = max(0.0, st);
        double t = 10.0 * j + st + dp[i][j] / (tren * st + 1.0);
        if (t - ep < vrem) ma = max(ma, i);
      }
    cout << ma << endl;
  }
}
