题目描述
Problem Description
Note: Kitamu is the name of the person who helped create this problem. Also, Kitamu's girlfriend is not Iroha-chan.
This is a story from before Kitamu captured his girlfriend. He had been told in advance:
"You are more than friends, less than lovers."
He thought:
"So that includes being lovers, right? It means it's okay to become lovers, right? Right?"
So, he decided to convey his feelings, but he thought that if he suddenly confessed, she might not accept it. Therefore, he decided to gradually convey his feelings over several days.
Kitamu will visit his girlfriend exactly $ M $ days out of the next $ N $ days to hint at his affection. Since he can predict her mood $ A_i $ for each day in advance, he wants to visit on the days when she is in a good mood as much as possible. However, he thought that leaving too much time between visits would not be good, so he decided to hint at his affection at least once every $ K $ days. Note that he has already hinted at his affection today.
You have become interested in simulating Kitamu's actions. Find the maximum total of his girlfriend's moods on the days he hints at his affection.
Input Format
The input is given from the standard input in the following format:
$ N $ $ M $ $ K $ $ A_1 $ $ A_2 $ $\cdots$ $ A_N $
Output Format
Output the maximum total of his girlfriend's moods on the days he hints at his affection in one line. If there is no way to satisfy the conditions, output -1.
Sample Input and Output
Sample Input #1
5 2 3
5 1 3 2 4
Sample Output #1
8
Sample Input #2
2 1 1
100 100
Sample Output #2
-1
Sample Input #3
1 1 1
100
Sample Output #3
100
Sample Input #4
10 6 4
56 1 82 32 4 11 74 49 90 6
Sample Output #4
383
Notes/Hints
Constraints
- All input values are integers.
- $1 \leq N \leq 365$
- $1 \leq M \leq N$
- $1 \leq K \leq N$
- $1 \leq A_i \leq 10^9$ $(1 \leq i \leq N)$
Sample Explanation 1
For example, if he hints at his affection on the 1st and 3rd days, the total mood is 8. It is impossible to achieve a total mood of 9 or more.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分