#include <bits/stdc++.h>
using namespace std;
int n, k, w;
int A[200010], T[200010], smA[200010], sm[200010], Less[200010];
int c1[10010], c2[10010];
void add1(int x, int y) {
  for (x; x <= 10000; x += x & (-x)) c1[x] += y;
}
void add2(int x, int y) {
  for (x; x <= 10000; x += x & (-x)) c2[x] += y;
}
int query1(int x) {
  int ans = 0;
  for (; x; x -= x & (-x)) ans += c1[x];
  return ans;
}
int query2(int x) {
  int ans = 0;
  for (; x; x -= x & (-x)) ans += c2[x];
  return ans;
}
int query(int k) {
  if (query1(10000) < k) return query2(10000);
  int l = 1, r = 10000;
  while (l < r) {
    int M = (l + r >> 1) + 1;
    if (query1(10000) - query1(M - 1) < k)
      r = M - 1;
    else
      l = M;
  }
  return query2(10000) - query2(l) + (k - (query1(10000) - query1(l))) * l;
}
int Ans;
void Work() {
  int l = 1, r = 0;
  while (l <= n) {
    while (r < n) {
      r++;
      add1(Less[r], 1);
      add2(Less[r], Less[r]);
      if (sm[r] - sm[l - 1] - query(k) > w) {
        add1(Less[r], -1);
        add2(Less[r], -Less[r]);
        r--;
        break;
      }
    }
    Ans = max(Ans, smA[r] - smA[l - 1]);
    add1(Less[l], -1);
    add2(Less[l], -Less[l]);
    l++;
  }
  cout << Ans << endl;
}
void Init() {
  scanf("%d%d%d", &n, &k, &w);
  for (int i = 1; i <= n; i++) scanf("%d", &A[i]), smA[i] = smA[i - 1] + A[i];
  for (int i = 1; i <= n; i++)
    scanf("%d", &T[i]), sm[i] = sm[i - 1] + T[i],
                        Less[i] = T[i] - (T[i] + 1) / 2;
}
int main() {
  Init();
  Work();
  return 0;
}
