#include<bits/stdc++.h>

using namespace std;
#define int long long
#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define int long long
const int N = 3e5 + 1100;
int a[N];
int b[N];
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m,t;
    cin >> n >> m >> t;
    for(int i=1;i<=n;++i){
        cin >> a[i];
    }
    for(int i=1;i<=m;++i){
        cin >> b[i];
    }
    int ans = 0;
    for(int j =1;j<=m;++j){
        int sum = 0;
        int k =0;
        for(int i = b[j];i>=1;i--){
            if(sum > t){
                break;
            }
            ans = max(ans,k + ((t-sum)/a[i]));
            ++k;
            sum += a[i];
        }
        sum = 0;
        k =0;
        for(int i = b[j];i<=n;i++){
            if(sum > t){
                break;
            }
            ans = max(ans,k + ((t-sum)/a[i]));
            ++k;
            sum += a[i];
        }
    }
    cout << ans << "\n";
    return 0;
}