#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, k, w;
int a[maxn], t[maxn];
struct SegmentTree {
  struct Node {
    int timer, val;
    Node() {}
    Node(int timer, int val) : timer(timer), val(val) {}
  } st[6 * maxn];
  int L[6 * maxn], R[6 * maxn];
  void Build(int k, int x, int y) {
    L[k] = x;
    R[k] = y;
    if (L[k] == R[k]) return;
    Build(k << 1, L[k], ((L[k] + R[k]) >> 1));
    Build(k << 1 | 1, ((L[k] + R[k]) >> 1) + 1, R[k]);
  }
  void Update(int k, int i, int val) {
    if (L[k] == R[k]) {
      st[k].timer += val;
      st[k].val = st[k].timer * i;
      return;
    }
    if (i <= ((L[k] + R[k]) >> 1))
      Update(k << 1, i, val);
    else
      Update(k << 1 | 1, i, val);
    st[k].timer = st[k << 1].timer + st[k << 1 | 1].timer;
    st[k].val = st[k << 1].val + st[k << 1 | 1].val;
  }
  int Query(int k, int &val) {
    if (val == 0) return 0;
    if (st[k].timer <= val) {
      val -= st[k].timer;
      return st[k].val;
    }
    if (L[k] == R[k]) {
      int M = min(st[k].timer, val);
      val -= M;
      return L[k] * M;
    }
    int ans = Query(k << 1 | 1, val);
    ans += Query(k << 1, val);
    return ans;
  }
  int Get(int w) { return Query(1, w); }
} Tree;
int main() {
  scanf("%d%d%d", &n, &w, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &t[i]);
  int l = 1;
  int S = 0, time = 0, ans = 0;
  Tree.Build(1, 0, 6000);
  for (int i = 1; i <= n; ++i) {
    S += a[i];
    time += t[i];
    Tree.Update(1, t[i] / 2, 1);
    while (l <= i && time - Tree.Get(w) > k) {
      Tree.Update(1, t[l] / 2, -1);
      S -= a[l];
      time -= t[l];
      ++l;
    }
    ans = max(ans, S);
  }
  printf("%d", ans);
  return 0;
}
