#include <bits/stdc++.h>
using namespace std;
int pleasure[200005], sum_pleasure[200005], t[200005], sum_t[200005], w;
struct node {
  int count, sum;
  node *left, *right;
  node(int count, int sum, node *left, node *right)
      : count(count), sum(sum), left(left), right(right) {}
  node *insert(int l, int r, int w, int val);
};
node *null = new node(0, 0, NULL, NULL);
node *node::insert(int l, int r, int w, int val) {
  if (l <= w && w <= r) {
    if (l == r) return new node(this->count + 1, this->sum + val, null, null);
    int mid = (l + r) / 2;
    return new node(this->count + 1, this->sum + val,
                    this->left->insert(l, mid, w, val),
                    this->right->insert(mid + 1, r, w, val));
  }
  return this;
}
int query(node *x, node *y, int a, int b, int req) {
  if (a == b) {
    if (x->count - y->count >= req)
      return a * req;
    else
      return x->sum - y->sum;
  }
  int mid = (a + b) / 2;
  if (x->right->count - y->right->count >= req)
    return query(x->right, y->right, mid + 1, b, req);
  else
    return x->right->sum - y->right->sum +
           query(x->left, y->left, a, mid,
                 req - (x->right->count - y->right->count));
}
node *root[200005];
int getceil(int x, int y) {
  if (x % y)
    return (x / y) + 1;
  else
    return x / y;
}
int total_time(int l, int r) {
  return sum_t[r] - sum_t[l - 1] - query(root[r], root[l - 1], 1, 10000, w);
}
int main() {
  ios::sync_with_stdio(false);
  ;
  cin.tie(0);
  ;
  int i, j, n, k, x, y, ans = 0, lo, mid, hi;
  cin >> n >> w >> k;
  for (i = 1; i <= n; i++) {
    cin >> pleasure[i];
    sum_pleasure[i] = sum_pleasure[i - 1] + pleasure[i];
  }
  for (i = 1; i <= n; i++) {
    cin >> t[i];
    sum_t[i] = sum_t[i - 1] + t[i];
  }
  null->left = null->right = null;
  root[0] = null;
  for (i = 1; i <= n; i++)
    root[i] = root[i - 1]->insert(1, 10000, t[i] - getceil(t[i], 2),
                                  t[i] - getceil(t[i], 2));
  for (i = 1; i <= n; i++) {
    lo = i;
    hi = n + 1;
    if (total_time(i, lo) > k) continue;
    while (hi - lo > 1) {
      mid = (lo + hi) / 2;
      if (total_time(i, mid) <= k)
        lo = mid;
      else
        hi = mid;
    }
    ans = max(ans, sum_pleasure[lo] - sum_pleasure[i - 1]);
  }
  cout << ans;
  return 0;
}
