#include <bits/stdc++.h>
using namespace std;
#define rall(x) x.rbegin(), x.rend()
#define int long long
signed main() {
    int t;
    cin >> t;
    while (t--) {
        int n, a, M;
        cin >> n >> a >> M;
        vector<int> b(n);
        for (auto& x : b) cin >> x;
        sort(rall(b));
        int ans = 1;
        auto check = [&](int h) {
            int tmp = 0;
            for (int i = 0; i < n; i++) {
                if (b[i] >= h) {
                    tmp += 1 + 2 * h * a;
                } else {
                    tmp += 1 + 2 * a * b[i];
                }
            }
            return tmp;
        };
        for (auto &x : b) {
            if (check(x) < M) {
                ans = x;
                break;
            }
            if (check(x - 1) < M) {
                ans = x - 1;
                break;
            }
        }
        cout << ans << endl;
    }
}