#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, w, k;
int a[N];
int b[N];
set<pair<int, int> > q1, q2;
int sa[N], sb[N];
int total = 0;
void insertTime(int u, int i) {
  q1.insert(make_pair(u, i));
  total += u / 2;
  if ((int)(q1).size() > w) {
    __typeof(q1.begin()) it = q1.begin();
    q2.insert(make_pair(it->first, it->second));
    total -= it->first / 2;
    q1.erase(it);
  }
}
void removeTime(int u, int i) {
  __typeof(q1.begin()) it1 = q1.find(make_pair(u, i));
  __typeof(q2.begin()) it2 = q2.find(make_pair(u, i));
  if (it1 != q1.end()) {
    total -= it1->first / 2;
    q1.erase(it1);
    if (!q2.empty()) {
      __typeof(q2.rbegin()) it2 = q2.rbegin();
      q1.insert(make_pair(it2->first, it2->second));
      total += it2->first / 2;
      q2.erase(--q2.end());
    }
  }
  if (it2 != q2.end()) {
    q2.erase(it2);
  }
}
int main() {
  scanf("%d %d %d", &n, &w, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    sa[i] = sa[i - 1] + a[i];
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", b + i);
    sb[i] = sb[i - 1] + b[i];
  }
  int ans = 0;
  int tim = 0, pos = 1;
  for (int i = 1; i <= n; ++i) {
    insertTime(b[i], i);
    while (pos <= i && sb[i] - sb[pos - 1] - total > k) {
      removeTime(b[pos], pos);
      pos++;
    }
    if (pos <= i && sb[i] - sb[pos - 1] - total <= k) {
      ans = max(ans, sa[i] - sa[pos - 1]);
    }
  }
  printf("%d\n", ans);
  return 0;
}
