#include <bits/stdc++.h>
// #define int int64_t
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;



signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int n, m, t; cin >> n >> m >> t;

    vector<int> a(n), b(m), pref(n + 1);

    for (int &i : a)
        cin >> i;
    for (int &i : b)
        cin >> i, i--;

    for (int i = 0; i < n; i++)
        pref[i + 1] = pref[i] + a[i];

    int res = 0;

    for (int st = 0; st < n; st++) {
        int cur_res = 0;
        int id = lower_bound(all(b), st) - b.begin();

        int l1 = 0, r1 = id;

        while (r1 - l1 > 1) {
            int mid = (r1 + l1) / 2;

            if (pref[st] - pref[b[mid]] <= t)
                r1 = mid;
            else
                l1 = mid;
        }

        for (int i = r1; i < id; i++) {
            int cur = t - (pref[st] - pref[b[i]]);
            cur_res = max(cur_res, (st - b[i]) * a[st] + cur);
        }

        l1 = id - 1, r1 = m;


        while (r1 - l1 > 1) {
            int mid = (r1 + l1) / 2;

            if (pref[b[mid] + 1] - pref[st + 1] > t)
                r1 = mid;
            else
                l1 = mid;
        }

        for (int i = id; i < r1; i++) {
            int cur = t - (pref[b[i] + 1] - pref[st + 1]);
            cur_res = max(cur_res, (b[i] - st) * a[st] + cur);
        }

        res = max(res, cur_res / a[st]);
    }

    cout << res;
}