#include <bits/stdc++.h>
using namespace std;
long b[2018], a[2018], n, m, s;
long long f[2018];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (long i = 1; i <= n; ++i) cin >> a[i];
  for (long i = 1; i <= m; ++i) cin >> b[i];
  cin >> s;
  for (long i = 1; i <= m; ++i) f[i] = s + 1;
  for (long i = 1; i <= m; ++i) {
    long long bien = 0;
    for (long j = i; j <= m; ++j) {
      bien = bien + b[j];
      if (bien > s) break;
      f[j - i + 1] = min(f[j - i + 1], bien);
    }
  }
  long ans = 0;
  for (long i = 1; i <= n; ++i) {
    long long bien = 0;
    for (long j = i; j <= n; ++j) {
      bien = bien + a[j];
      if (bien > s) break;
      long l = 0, r = m + 1;
      while (r - l > 1) {
        long t = (l + r) / 2;
        if (bien * f[t] <= s)
          l = t;
        else
          r = t;
      }
      ans = max(ans, (j - i + 1) * l);
    }
  }
  cout << ans;
  return 0;
}
