Partial Sum
题号:NC52864
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld

题目描述

Bobo has a integer sequence of length n.
Each time, he selects two ends and add into a counter which is zero initially.
He repeats the selection for *at most* m times.

If each end can be selected at most once (either as left or right), find out the maximum sum Bobo may have.

输入描述:

The input contains zero or more test cases and is terminated by end-of-file. For each test case:
The first line contains three integers n, m, C.
The second line contains n integers .
*
*
*
* The sum of n does not exceed .

输出描述:

For each test cases, output an integer which denotes the maximum.
示例1

输入

复制
4 1 1
-1 2 2 -1
4 2 1
-1 2 2 -1
4 2 2
-1 2 2 -1
4 2 10
-1 2 2 -1

输出

复制
3
4
2
0