#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
const int inf = numeric_limits<int>::max() / 2;
const long double eps = 1e-9;
const long double pi = acos(-1);
inline void solve(), read();
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  read();
  solve();
  return 0;
}
int n, m;
vector<int> a, b;
int x;
inline void solve() {
  set<pair<int, int> > ma;
  for (int i = 0; i < n; i++) {
    int s = 0;
    for (int j = i; j < n; j++) {
      s += a[j];
      auto it = ma.lower_bound({s, -inf});
      if (it == ma.end() || it->first != s) {
        ma.insert({s, j - i + 1});
      } else {
        if (it->second < j - i + 1) {
          ma.erase(it);
          ma.insert({s, j - i + 1});
        }
      }
    }
  }
  vector<pair<int, int> > ps;
  int cur = 0;
  for (pair<int, int> p : ma) {
    (cur) = ((cur) < (p.second)) ? (p.second) : (cur);
    ps.push_back({p.first, max(p.second, cur)});
  }
  int ans = 0;
  for (int i = 0; i < m; i++) {
    int s = 0;
    for (int j = i; j < m; j++) {
      s += b[j];
      auto it =
          upper_bound((ps).begin(), (ps).end(), pair<int, int>(x / s, inf));
      if (it == ps.begin()) {
        continue;
      }
      --it;
      (ans) = ((ans) < ((j - i + 1) * it->second)) ? ((j - i + 1) * it->second)
                                                   : (ans);
    }
  }
  cout << ans << "\n";
}
inline void read() {
  cin >> n >> m;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  b.resize(m);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  cin >> x;
}
