#include <bits/stdc++.h>
#define int __int128_t
#define double long double

using namespace std;

signed main() {
    signed n1, m1, t1;
    cin >> n1 >> m1 >> t1;
    int n = n1, m = m1, t = t1;
    vector<int> a(n), b(m);
    for (auto& i : a) {
        signed x;
        cin >> x;
        i = x;
    }
    for (auto& i : b) {
        signed x;
        cin >> x;
        i = x;
    }
    vector<int> pref(n);
    pref[0] = a[0];
    for (int i = 1; i < n; i++) {
        pref[i] = pref[i - 1] + a[i];
    }
    vector<int> optl(n);
    vector<int> dpl(n);
    dpl[0] = t / a[0];
    vector<array<int, 2>> st = {{a[0], 0}};
    for (int i = 1; i < n; i++) {
        optl[i] = i;
        dpl[i] = t / a[i];
        while (st.size() && st.back()[0] > a[i]) st.pop_back();
        if (st.size()) {
            int j = optl[st.back()[1]];
            // cout << i << " " << j << "\n";
            int cur = i - j + (t - pref[i] + pref[j]) / a[j];
            if (t * a[j] < (i - j) * a[i] * a[j] + (t - pref[i] + pref[j]) * a[i]) {
                optl[i] = j;
                dpl[i] = cur;
            }
        }
        st.push_back({a[i], i});
    }
    // for (int i : optl) cout << i << " ";
    // cout << "\n";
    // for (int i : dpl) cout << i << " ";
    // cout << "\n";
    int ans = 0;
    for (int i : b) {
        ans = max(ans, dpl[i - 1]);
    }
    cout << (signed)ans << "\n";
}