#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, w, k, a[N], t[N], h[N], idx = 1, sum, mx;
set<pair<int, int> > have, full;
bool can() { return sum - mx <= k; }
void add(int idx) {
  sum += t[idx];
  if (full.size() < w) {
    full.insert(make_pair(t[idx], idx));
    mx += h[idx];
    return;
  }
  if ((*full.begin()).first <= t[idx]) {
    have.insert(*full.begin());
    mx -= h[(*full.begin()).second];
    full.erase(full.begin());
    full.insert(make_pair(t[idx], idx));
    mx += h[idx];
    return;
  }
  have.insert(make_pair(t[idx], idx));
}
void erase(int idx) {
  pair<int, int> myP = make_pair(t[idx], idx);
  if (full.find(myP) != full.end()) {
    sum -= t[idx];
    mx -= h[myP.second];
    full.erase(myP);
  }
  if (have.find(myP) != have.end()) {
    sum -= t[idx];
    have.erase(myP);
  }
  while (full.size() < w && have.size()) {
    full.insert(*(--have.end()));
    mx += h[(*--have.end()).second];
    have.erase(--have.end());
  }
}
int main() {
  scanf("%d%d%d", &n, &w, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &t[i]);
    h[i] = t[i] - (t[i] / 2 + (t[i] % 2 != 0));
  }
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    if (idx < i) idx = i;
    while (idx <= n) {
      add(idx);
      if (!can()) {
        erase(idx);
        break;
      }
      idx++;
    }
    if (can()) {
      res = max(res, a[idx - 1] - a[i - 1]);
      erase(i);
    }
  }
  printf("%d\n", res);
  return 0;
}
