Sasha reaches the work by car. It takes exactly k minutes. On his way he listens to music. All songs in his playlist go one by one, after listening to the i-th song Sasha gets a pleasure which equals ai. The i-th song lasts for ti minutes. 

Before the beginning of his way Sasha turns on some song x and then he listens to the songs one by one: at first, the song x, then the song (x + 1), then the song number (x + 2), and so on. He listens to songs until he reaches the work or until he listens to the last song in his playlist. 

Sasha can listen to each song to the end or partly.

In the second case he listens to the song for integer number of minutes, at least half of the song's length. Formally, if the length of the song equals d minutes, Sasha listens to it for no less than <image> minutes, then he immediately switches it to the next song (if there is such). For example, if the length of the song which Sasha wants to partly listen to, equals 5 minutes, then he should listen to it for at least 3 minutes, if the length of the song equals 8 minutes, then he should listen to it for at least 4 minutes.

It takes no time to switch a song.

Sasha wants to listen partly no more than w songs. If the last listened song plays for less than half of its length, then Sasha doesn't get pleasure from it and that song is not included to the list of partly listened songs. It is not allowed to skip songs. A pleasure from a song does not depend on the listening mode, for the i-th song this value equals ai.

Help Sasha to choose such x and no more than w songs for partial listening to get the maximum pleasure. Write a program to find the maximum pleasure Sasha can get from the listening to the songs on his way to the work.

Input

The first line contains three integers n, w and k (1 ≤ w ≤ n ≤ 2·105, 1 ≤ k ≤ 2·109) — the number of songs in the playlist, the number of songs Sasha can listen to partly and time in minutes which Sasha needs to reach work. 

The second line contains n positive integers a1, a2, ..., an (1 ≤ ai ≤ 104), where ai equals the pleasure Sasha gets after listening to the i-th song.

The third line contains n positive integers t1, t2, ..., tn (2 ≤ ti ≤ 104), where ti equals the length of the i-th song in minutes.

Output

Print the maximum pleasure Sasha can get after listening to the songs on the way to work. 

Examples

Input

7 2 11
3 4 3 5 1 4 6
7 7 3 6 5 3 9


Output

12


Input

8 4 20
5 6 4 3 7 5 4 1
10 12 5 12 14 8 5 8


Output

19


Input

1 1 5
6
9


Output

6


Input

1 1 3
4
7


Output

0

Note

In the first example Sasha needs to start listening from the song number 2. He should listen to it partly (for 4 minutes), then listen to the song number 3 to the end (for 3 minutes) and then partly listen to the song number 4 (for 3 minutes). After listening to these songs Sasha will get pleasure which equals 4 + 3 + 5 = 12. Sasha will not have time to listen to the song number 5 because he will spend 4 + 3 + 3 = 10 minutes listening to songs number 2, 3 and 4 and only 1 minute is left after that. 
#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > seti, setfull;
set<pair<int, int> >::iterator it1, it, it2;
int arr[212345] = {0};
int a[212345] = {0};
int t[212345] = {0};
int main() {
  std::ios::sync_with_stdio(false);
  int n, w, k;
  cin >> n >> w >> k;
  int i = 0;
  int j = 0;
  long long plea = 0;
  long long total = 0;
  long long totalnew = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> t[i];
  }
  i = 0;
  j = 0;
  long long maxi = 0;
  long long val;
  while (j < n) {
    if (seti.size() < w) {
      if (total + (t[j] + 1) / 2 <= k) {
        seti.insert(make_pair((t[j] + 1) / 2, j));
        arr[j] = 1;
        total += (t[j] + 1) / 2;
        plea += a[j];
        j++;
      } else {
        if (arr[i] == 1) {
          seti.erase(make_pair((t[i] + 1) / 2, i));
          plea -= a[i];
          total -= (t[i] + 1) / 2;
          arr[i] = 0;
        } else {
          j++;
        }
        i++;
      }
    } else {
      it = seti.begin();
      int val = it->second;
      if (t[val] < t[j]) {
        totalnew = total + (t[val]) - (t[val] + 1) / 2 + (t[j] + 1) / 2;
        if (totalnew <= k) {
          seti.erase(it);
          setfull.insert(make_pair(t[val], val));
          arr[val] = 0;
          plea += a[j];
          total = totalnew;
          seti.insert(make_pair((t[j] + 1) / 2, j));
          arr[j] = 1;
          j++;
        } else {
          if (arr[i] == 1) {
            seti.erase(make_pair((t[i] + 1) / 2, i));
            plea -= a[i];
            total -= (t[i] + 1) / 2;
            if (!setfull.empty()) {
              it = setfull.end();
              it--;
              val = it->second;
              arr[val] = 1;
              arr[i] = 0;
              setfull.erase(it);
              total -= t[val];
              total += (t[val] + 1) / 2;
              seti.insert(make_pair((t[val] + 1) / 2, val));
            }
          } else {
            setfull.erase(make_pair(t[i], i));
            plea -= a[i];
            total -= t[i];
          }
          i++;
        }
      } else {
        totalnew = total + t[j];
        if (totalnew <= k) {
          setfull.insert(make_pair(t[j], j));
          plea += a[j];
          total += t[j];
          j++;
        } else {
          if (arr[i] == 1) {
            seti.erase(make_pair((t[i] + 1) / 2, i));
            plea -= a[i];
            total -= (t[i] + 1) / 2;
            arr[i] = 0;
            if (!setfull.empty()) {
              it = setfull.end();
              it--;
              val = it->second;
              arr[val] = 1;
              setfull.erase(it);
              total -= t[val];
              total += (t[val] + 1) / 2;
              seti.insert(make_pair((t[val] + 1) / 2, val));
            }
          } else {
            setfull.erase(make_pair(t[i], i));
            plea -= a[i];
            total -= t[i];
          }
          i++;
        }
      }
    }
    maxi = max(maxi, plea);
  }
  cout << maxi << endl;
}
