#include <bits/stdc++.h>
using namespace std;
void rs(int &x) { scanf("%d", &x); }
void rsl(long long &x) { scanf("%I64d", &x); }
void rsd(double &x) { scanf("%lf", &x); }
void rss(char *str) { scanf("%s", str); }
void ws(int &x) { printf("%d ", x); }
void wsl(long long &x) { printf("%I64d ", x); }
void wsd(double &x) { printf("%lf ", x); }
void wss(char *str) { printf("%s ", str); }
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int const N = (2e5) + 5;
int const mod = (1e9) + 7;
int a[N], t[N], suma[N], sumt[N];
priority_queue<int> que;
set<pair<int, int>> ms, mns;
map<int, int> mm;
int ins[N], inns[N];
int main() {
  int n, w, k;
  cin >> n >> w >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    suma[i] = suma[i - 1] + a[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> t[i];
    mm[t[i]] = i;
    sumt[i] = sumt[i - 1] + t[i];
  }
  int ans = 0;
  int r = 1;
  int ct = 0;
  int cp = 0;
  for (int i = 1; i <= n; ++i) {
    r = max(r, i);
    while (r <= n) {
      int dt = 0;
      if (ms.size() < w) {
        dt = t[r] / 2 + t[r] % 2;
        if (ct + dt <= k) {
          ms.insert(make_pair(t[r], r));
          ins[r] = 1;
          ct += dt;
        } else {
          break;
        }
      } else {
        int var = ms.begin()->first;
        if (t[r] > var) {
          int dt = t[r] / 2 + t[r] % 2;
          int ddt = (var / 2);
          if (ct + dt + ddt <= k) {
            ins[ms.begin()->second] = 0;
            ins[r] = 1;
            mns.insert(*ms.begin());
            ms.erase(ms.begin());
            ms.insert(make_pair(t[r], r));
            ct += dt + ddt;
          } else {
            break;
          }
        } else {
          int dt = t[r];
          if (ct + dt <= k) {
            ct += dt;
            mns.insert(make_pair(t[r], r));
          } else {
            break;
          }
        }
      }
      r++;
    }
    ans = max(suma[r - 1] - suma[i - 1], ans);
    if (ins[i] == 0) {
      ct -= t[i];
    } else {
      ct -= (t[i] / 2 + t[i] % 2);
      ins[i] = 0;
      set<pair<int, int>>::iterator it = ms.find(make_pair(t[i], i));
      if (it != ms.end()) {
        ms.erase(it);
      }
      while (mns.size() > 0 && ((--mns.end())->second <= i)) {
        mns.erase(--mns.end());
      }
      if (mns.size() > 0) {
        it = --mns.end();
        ct -= ((it->first) / 2);
        ins[it->second] = 1;
        ms.insert(*(--mns.end()));
        mns.erase((--mns.end()));
      }
    }
  }
  cout << ans;
  return 0;
}
