#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <experimental/random>

#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3, unroll-loops")
using namespace __gnu_pbds;
using namespace std;
using ordered_set = tree<long long, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;
using ld = long double;
using str = string;
#define all(a) a.begin(), a.end()
#define len(a) int(a.size())
#define pb push_back
#define pbb pop_back
#define vc vector
#define F first
#define S second
#define rev reverse

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    ll t;
    cin >> n >> m >> t;
    vector<ll> a(n), b(m);
    vector<ld> pref(n + 1);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        pref[i + 1] = pref[i] + a[i];
    }
    for (int i = 0; i < m; i++) cin >> b[i];
    ll ans = 0;
    ld mx = 0;
    vector<ld> f1(n), f2(n);
    for (int i = 0; i < n; i++) {
        f1[i] = ld(t - pref[i]) / a[i] + i;
        f2[i] = ld(t + pref[i + 1]) / a[i] - i;
    }
    for (int k = 0; k < m; k++) {
        int i = b[k] - 1;
        for (int start = 0; start < n; start++) {
            if (i < start) {
                mx = max(mx, pref[i] / a[start] + f1[start] - i);
            } else {
                mx = max(mx, f2[start] - pref[i + 1] / a[start] + i);
            }
        }
    }
    ll l = -1;
    ll r = 1e18;
    while (r - l > 1) {
        ll mid = (l + r) / 2;
        if (mid <= mx) {
            l = mid;
        } else {
            r = mid;
        }
    }
    cout << l;
    return 0;
}
