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

using namespace __gnu_pbds;
using namespace std;

template<class T>
using order_set = tree<T, nullptr_t, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

using ll = long long;
using ld = long double;
using mll = map<ll, ll>;
using pll = pair<ll, ll>;
using vll = vector<ll>;

const ll inf = 1e16;
const ll mod = 1e9 + 7;
const ld eps = 1e-9;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ll n, m, T;
    cin >> n >> m >> T;
    vector<ll> a(n), b(m);
    for (ll &i: a)
        cin >> i;
    for (ll &i: b) {
        cin >> i;
        i--;
    }

    vector<ll> p(n + 1);
    for (ll i = 0; i < n; i++)
        p[i + 1] = p[i] + a[i];

    auto f = [&](ll i, ll j) -> ll {
        return p[max(i, j) + 1] - p[min(i, j)];
    };

    ll ans = 0;
    for (ll i = 0; i < n; i++)
        for (ll j = 0; j < m; j++)
            if (f(i, b[j]) <= T)
                ans = max(ans, abs(i - b[j]) + (T - f(i, b[j])) / a[i] + 1);
    cout << ans << '\n';
}
