#include <bits/stdc++.h>
using namespace std;
int n, w, k, a[200200], cc[200200];
pair<int, int> tree[4 * 10010 + 44];
void update(int x, int l, int r, int g, int y) {
  if (l == r) {
    tree[x].first += y;
    tree[x].second += l * y;
    return;
  }
  int m = (l + r) / 2;
  if (g <= m)
    update(x * 2, l, m, g, y);
  else
    update(x * 2 + 1, m + 1, r, g, y);
  tree[x].first = tree[x * 2].first + tree[x * 2 + 1].first;
  tree[x].second = tree[x * 2].second + tree[x * 2 + 1].second;
}
int sum(int x, int l, int r, int need) {
  if (l == r) return l * min(need, tree[x].second);
  int m = (l + r) / 2;
  if (tree[x * 2 + 1].first <= need)
    return sum(x * 2, l, m, need - tree[x * 2 + 1].first) +
           tree[x * 2 + 1].second;
  else
    return sum(x * 2 + 1, m + 1, r, need);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> w >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= n; i++) cin >> cc[i];
  int j = n, s = 0, cnt = 0;
  for (int i = n; i >= 1; i--) {
    s += cc[i];
    update(1, 1, 10010, cc[i] / 2, 1);
    while (s - sum(1, 1, 10010, w) > k) {
      update(1, 1, 10010, cc[j] / 2, -1);
      s -= cc[j];
      j--;
    }
    cnt = max(cnt, a[j] - a[i - 1]);
  }
  cout << cnt << endl;
}
