#include <bits/stdc++.h>


using namespace std;


using ll = long long;


template<typename T>
ostream & operator <<(ostream &os, const vector<T> &a) {
    for (T el : a) {
        os << el << " ";
    }
    os << '\n';
    return os;
}


ll func(const vector<ll> &a, int pos, ll T) {
    ll buf = T;
    ll cnt = 0;
    ll prev = 0;
    for (int i = pos; i >= 0; i--) {
        ll curr = buf / a.at(i);
        cnt = max(curr + prev, cnt);
        prev++;
        buf -= a.at(i);
    }
    prev = 0;
    buf = T;
    for (int i = pos; i < int(a.size()); i++) {
        ll curr = buf / a.at(i);
        cnt = max(curr + prev, cnt);
        prev++;
        buf -= a.at(i);
    }
    return cnt;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    ll T;
    cin >> n >> m >> T;
    vector<ll> a(n);
    vector<int> b(m);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    ll ans = 0;
    for (int i = 0; i < m; i++) {
        cin >> b.at(i);
        b.at(i)--;
        ans = max(func(a, b.at(i), T), ans);
    }
    cout << ans;
    return 0;
}
