#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;

inline int MAX(int a, int b) {
    if (a > b)
        return a;
    return b;
}


const int64_t INF = 1e18;

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;

    int r1 = 0, r2 = 0;

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

        while (r1 < id && pref[st] - pref[b[r1]] > t)
            r1++;

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

        cur_res += 1ll * st * a[st] - pref[st] + t;
        if (cur_res > 0)
            res = MAX(res, 1ll * cur_res / a[st]);
    }

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

        while (r2 < m && pref[b[r2] + 1] - pref[st + 1] <= t)
            r2++;
 
        int64_t cur_res = -INF;

        for (int i = id; i < r2; i++) {
            cur_res = MAX(cur_res, (int64_t)1ll * b[i] * a[st] - pref[b[i] + 1]);
        }

        cur_res += pref[st + 1] + t - 1ll * st * a[st];


        if (cur_res > 0)
            res = MAX(res, cur_res / a[st]);
    }

    cout << res;
}