#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 105;
double c;
double poww[MAX_N + 5];
double dp[MAX_N][MAX_N * 10], dp2[MAX_N][MAX_N * 10];
pair<int, int> a[MAX_N];
bool check(double m, double t) {
  double curA = c;
  double curB = 1 - c * t;
  double curC = m - t;
  double curD = curB * curB - 4 * curA * curC;
  if (curD < 0) return 0;
  double x1 = (-curB - sqrt(curD)) / (2 * curA);
  double x2 = (-curB + sqrt(curD)) / (2 * curA);
  if (x1 > x2) swap(x1, x2);
  if (x1 > t || x2 < 0) return 0;
  return 1;
}
void update(double &val, double newVal) {
  if (val < -0.5 || val > newVal) val = newVal;
}
int main() {
  int tc;
  scanf("%d", &tc);
  poww[0] = 1;
  for (int i = (1); (i) < (MAX_N); ++i) poww[i] = poww[i - 1] * 10. / 9;
  for (int tt = 0; (tt) < (tc); ++tt) {
    int n;
    double t;
    scanf("%d%lf%lf", &n, &c, &t);
    for (int i = 0; (i) < (n); ++i) scanf("%d%d", &a[i].first, &a[i].second);
    sort(a, a + n);
    reverse(a, a + n);
    for (int i = 0; (i) < (n + 1); ++i)
      for (int j = 0; (j) < ((n + 1) * 10 + 1); ++j) dp[i][j] = dp2[i][j] = -1;
    dp[0][0] = 0;
    for (int i = 0; (i) < (n); ++i) {
      for (int j = (i + 1) - 1; (j) >= 0; --j)
        for (int g = (10 * j + 1) - 1; (g) >= 0; --g) {
          if (dp[j][g] != -1) {
            update(dp2[j][g], dp[j][g]);
            update(dp2[j + 1][g + a[i].second],
                   dp[j][g] + a[i].first * poww[j + 1]);
          }
        }
      for (int j = 0; (j) < (i + 2); ++j)
        for (int g = 0; (g) < (10 * j + 1); ++g)
          dp[j][g] = dp2[j][g], dp2[j][g] = -1;
    }
    int ans = 0;
    for (int i = 0; (i) < (n + 1); ++i)
      for (int j = 0; (j) < (10 * n + 1); ++j) {
        if (dp[i][j] > 0) {
          if (t >= 10 * i && check(dp[i][j], t - 10 * i)) {
            ans = max(ans, j);
          }
        }
      }
    printf("%d\n", ans);
  }
  return 0;
}
