//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2")
#define _GLIBCXX_DEBUG 1
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

#define forsn(i,s,e) for(ll i = s; i <= e; i++)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln '\n'
#define all(x) x.begin(), x.end()

const ll inf = INT64_MAX;

vector <ll> pref;

ll get_sum(ll l, ll r) {
    if (l > r)
        swap(l, r);
    return pref[r] - pref[l - 1];
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0);

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

    pref.resize(n + 1);
    pref[0] = 0;
    forsn(i, 1, n) {
        pref[i] = pref[i - 1] + a[i - 1];
    }

    ll ans = 0;
    forsn(j, 0, m - 1) {
        forsn(i, 1, n) {
            ll t = get_sum(b[j], i);
            ll val = i - b[j] + 1 + (T - t) / a[i - 1];
            ans = max(ans, val);
        }
    }

    cout << ans;

    return 0;
}
