#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 int INF = 1e18;

vector<int> ast;

struct line {
    int k = -1, b = -INF;
    int left = -1, right = -1;
    line(int kk, int bb) : k(kk), b(bb) {}
    line() {}
    int operator()(int x) {
        return k * x + b;
    }
};

struct li_chao {
    vector<line> t;

    li_chao() {
        t.push_back({});
    }

    void insert(int p, int l, int r, line x) {
        int m = (r + l) / 2;
        bool mid = t[p](ast[m]) > x(ast[m]);

        if (!mid)
            swap(t[p], x);
        
        if (r - l == 1)
            return;
    
        bool lft = t[p](ast[l]) > x(ast[l]);
        
        if (lft) {
            if (t[p].right == -1)
                t[p].right = t.size(), t.push_back({});

            insert(t[p].right, m, r, x);
        } else {
            if (t[p].left == -1)
                t[p].left = t.size(), t.push_back({});

            insert(t[p].left, l, m, x);
        }
    }


    int get(int p, int l, int r, int id) {
        int m = (r + l) / 2;

        int mx = t[p](ast[id]);

        if (r - l == 1)
            return mx;

        if (id < m && t[p].left != -1)
            return max(get(t[p].left, l, m, id), mx);
        else if (id >= m && t[p].right != -1)
            return max(get(t[p].right, m, r, id), mx);
        return mx;
    }
};

const int N = 3e5 + 100;

li_chao t[2 * N];

int z;

#define LF p + 1
#define RF p + 2 * (m - l)

void build(int p, int l, int r, vector<line> &a) {
    t[p] = li_chao();
    if (r - l == 1) {
        t[p].insert(0, 0, z, a[l]);
        return;
    }

    int m = (r + l) / 2;
    build(LF, l, m, a);
    build(RF, m, r, a);

    for (int i = l; i < r; i++)
        t[p].insert(0, 0, z, a[i]);
}

int get(int p, int l, int r, int lq, int rq, int id) {
    if (l >= rq || lq >= r)
        return -INF;

    if (l >= lq && r <= rq) {
        return t[p].get(0, 0, z, id);
    }

    int m = (r + l) / 2;
    return MAX(get(LF, l, m, lq, rq, id), get(RF, m, r, lq, rq, id));
}

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

    ast = a;

    sort(all(ast));

    z = ast.size();

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

    int res = 0;

    int r1 = 0, r2 = 0;

    vector<line> pp(m);

    for (int i = 0; i < m; i++)
        pp[i] = line(-b[i], pref[b[i]]);

    build(0, 0, m, pp);

    for (int st = 0; st < n; st++) {
        int 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++) {
        //     int cur = t - (pref[st] - pref[b[i]]);
        //     cur_res = MAX(cur_res, (st - b[i]) * a[st] + cur);
        // }

        cur_res = get(0, 0, m, r1, id, lower_bound(all(ast), a[st]) - ast.begin());

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


        // li_chao cr;
        // for (int i = r1; i < id; i++) {
        //     cr.insert(0, 0, z, pp[i]);
        // }

        // cur_res = cr.get(0, 0, z, lower_bound(all(ast), a[st]) - ast.begin());
        
        cur_res += st * a[st] - pref[st] + t;
        res = MAX(res, cur_res / a[st]);
    }


    for (int i = 0; i < m; i++)
        pp[i] = line(b[i], -pref[b[i] + 1]);

    build(0, 0, m, pp);

    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++;
 
        int cur_res = -INF;

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

        cur_res = get(0, 0, m, id, r2, lower_bound(all(ast), a[st]) - ast.begin());

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

        // for (int i = id; i < r2; i++) {
        //     cur_res = MAX(cur_res, pp[i](a[st]));
        // }

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

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

    cout << res;
}