#include <bits/stdc++.h>
using namespace std;
int n;
long double C, T;
pair<int, int> a[111];
long double dp[2][107][1017];
void up(long double &a, long double b) {
  if (a < 0)
    a = b;
  else
    a = min(a, b);
}
long double step[111];
void solve() {
  cin >> n >> C >> T;
  for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < 107; i++)
    for (int j = 0; j < 1017; j++) dp[0][i][j] = dp[1][i][j] = -1;
  dp[0][0][0] = 0;
  step[0] = (long double)10 / 9;
  for (int i = 1; i < 111; i++) step[i] = step[i - 1] * 10 / (long double)9;
  for (int i = 0; i < n; i++) {
    for (int s = 0; s <= i + 1; s++)
      for (int j = 0; j <= 10 * (i + 1); j++)
        if (!(dp[0][s][j] < 0)) {
          up(dp[1][s][j], dp[0][s][j]);
          up(dp[1][s + 1][j + a[i].second],
             dp[0][s][j] + (long double)a[i].first * step[s]);
        }
    for (int s = 0; s <= n; s++)
      for (int j = 0; j < 1007; j++)
        dp[0][s][j] = dp[1][s][j], dp[1][s][j] = -1;
  }
  int ans = 0;
  for (int now = 0; now < 1017; now++)
    for (int d = 0; d <= n; d++)
      if (dp[0][d][now] != -1) {
        long double ti = dp[0][d][now];
        long double pos = max((long double)0, (sqrt(C * ti) - 1) / C);
        if ((pos + ti / (1 + C * pos) + 10 * d) <= T) ans = max(ans, now);
      }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    solve();
  }
}
