Cross Fire
题号:NC244825
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

CF is a multinational multi player real-time online exciting electronic sports game . Happy , an old retired player , can not extricate himself from being addicted to CF .

The game will hold competitions frequently . After each competition , the rating of the participants in the game will increase or decrease according to their performance .

It's a pity that such competitions are all late at night . Happy's body does not support him to stay up late to play games continuously . Therefore, every time he stays up late to play a game, he needs to rest for at least k days , that is , if he played a game at the i-th day , the next game can only be played at the j-th () day .

However, as Happy is a fanatic , once he has rested for more than or equal to k days , he will firmly participate in the next game .

Happy is a person with strong desire to win . He saw the game arrangement of CF , and according to the information obtained , he estimated how much his rating would increase or decrease after he participated in the game .

Happy's wife was very resistant to this, so she put forward a request :

Happy can choose any date to start his first game ( we call that CF journey ), then played at most m games . In his CF journey , if Happy wants to give up , he can end his journey at any day .

Please help Happy to calculate the maximum rating he can get .

输入描述:

The first line contains three integers n,m,k . As described in the statement . 

Then the second line contains n integers a_1,a_2,...,a_n , indicate the date of the n games .

The next line contains n integers , indicates the rating changes if Happy participated each game .

输出描述:

Output an integer in a single line , indicates the answer .
示例1

输入

复制
5 3 1
1 2 3 4 5
5 3 3 -2 -3

输出

复制
8

说明

In the first case , Happy can choose day 1 as his first game , and participates the first and the third games to get 5+3=8 rating , then decides to end his journey .
示例2

输入

复制
5 3 1
1 2 3 4 5
-5 -3 -3 -2 -3

输出

复制
0

说明

In the second case , Happy's best choice is to sleep .