You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers. 

Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves:   move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x<n$.  move left — go from your current index $x$ to $x-1$ and add $a_{x-1}$ to your score. This move can only be performed if $x>1$. Also, you can't perform two or more moves to the left in a row. 

You want to perform exactly $k$ moves. Also, there should be no more than $z$ moves to the left among them.

What is the maximum score you can achieve?


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of testcases.

The first line of each testcase contains three integers $n, k$ and $z$ ($2 \le n \le 10^5$, $1 \le k \le n - 1$, $0 \le z \le min(5, k)$) — the number of elements in the array, the total number of moves you should perform and the maximum number of moves to the left you can perform.

The second line of each testcase contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^4$) — the given array.

The sum of $n$ over all testcases does not exceed $3 \cdot 10^5$.


-----Output-----

Print $t$ integers — for each testcase output the maximum score you can achieve if you make exactly $k$ moves in total, no more than $z$ of them are to the left and there are no two or more moves to the left in a row.


-----Example-----
Input
4
5 4 0
1 5 4 3 2
5 4 1
1 5 4 3 2
5 4 4
10 20 30 40 50
10 7 3
4 6 8 2 9 9 7 4 10 9

Output
15
19
150
56



-----Note-----

In the first testcase you are not allowed to move left at all. So you make four moves to the right and obtain the score $a_1 + a_2 + a_3 + a_4 + a_5$.

In the second example you can move one time to the left. So we can follow these moves: right, right, left, right. The score will be $a_1 + a_2 + a_3 + a_2 + a_3$.

In the third example you can move four times to the left but it's not optimal anyway, you can just move four times to the right and obtain the score $a_1 + a_2 + a_3 + a_4 + a_5$.

Difficulty: MEDIUM_HARD

Solutions:
from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def calculate_sum(a, N):
	m = N / a
	sum = m * (m + 1) / 2
	ans = a * sum
	return ans

def series(N):
	return N * (N + 1) // 2

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def LCM(x, y):
	return x * y // GCD(x, y)

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def isprime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	(n, k, z) = spin()
	a = lin()
	(s, ans, mx) = (0, 0, 0)
	for i in range(k + 1):
		if i < n - 1:
			mx = max(mx, a[i] + a[i + 1])
		s += a[i]
		if i % 2 == k % 2:
			temp = (k - i) // 2
			if temp <= z:
				ans = max(ans, s + mx * temp)
	print(ans)


t = int(input())
inf = 10000000000000000
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	dp = [[[0, 0] for i in range(z + 1)] for i in range(n)]
	dp[0][0][0] = a[0]
	for i in range(1, n):
		dp[i][0][0] = dp[i - 1][0][0] + a[i]
	for i in range(1, z + 1):
		for j in range(1, n):
			dp[j - 1][i][1] = max(dp[j - 1][i][1], dp[j][i - 1][0] + a[j - 1])
		for j in range(1, n):
			dp[j][i][0] = max(dp[j - 1][i][0] + a[j], dp[j - 1][i][1] + a[j])
	ans = 0
	for i in range(z + 1):
		if k - 2 * i >= 0:
			ans = max(ans, dp[k - 2 * i][i][0])
			ans = max(ans, dp[k - 2 * i][i][1])
	print(ans)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	dp = [[[0] * 2 for i in range(z + 1)] for i in range(k + 1)]
	dp[0][0][0] = a[0]
	for i in range(k):
		for times in range(z + 1):
			pos = i - 2 * times
			if pos >= 0:
				dp[i + 1][times][0] = max(dp[i][times][0] + a[pos + 1], dp[i + 1][times][0])
				dp[i + 1][times][0] = max(dp[i][times][1] + a[pos + 1], dp[i + 1][times][0])
			if times + 1 < z + 1 and pos >= 1:
				dp[i + 1][times + 1][1] = max(dp[i][times][0] + a[pos - 1], dp[i + 1][times + 1][1])
	ans = 0
	for arr in dp[-1]:
		for val in arr:
			ans = max(val, ans)
	print(ans)


def abc(l, i, n, k, m):
	if k == 0:
		return 0
	if i == n - 1:
		if k:
			if m:
				return l[i] + abc(l, i - 1, n, k - 1, m - 1)
			return l[i]
		return 0
	if i == 0:
		return l[0] + abc(l, i + 1, n, k - 1, m)
	if m == 0:
		return l[i] + abc(l, i + 1, n, k - 1, m)
	return l[i] + max(abc(l, i - 1, n, k - 1, m - 1), abc(l, i + 1, n, k - 1, m))
t = int(input())
for _ in range(t):
	(n, k, m) = map(int, input().split())
	l = list(map(int, input().split()))
	v = [0]
	for i in l:
		v.append(v[-1] + i)
	ans = 0
	for i in range(1, n):
		p = k
		if p >= i:
			c = v[i + 1]
			p -= i
		else:
			p = 0
			c = v[p + 1]
		ans = max(ans, c)
		d = l[i] + l[i - 1]
		y = p
		for j in range(min(p // 2, m)):
			c += d
			y = y - 2
			ans = max(ans, c + v[i + 1 + y] - v[i + 1])
		d = m - min(p // 2, m)
		if y and d:
			c += l[i - 1]
			ans = max(ans, c)
	print(ans)


OK = lambda : map(int, input().split())
(t,) = OK()
for _ in [0] * t:
	(n, m, z) = OK()
	a = (*OK(),)
	print(max((sum(a[:m + 1 - 2 * i]) + i * max(map(sum, zip(a, a[1:m + 2 - (2 * i or m)]))) for i in range(min(z, m // 2) + 1))))


for i in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = [int(x) for x in input().split()]
	ans = 0
	s = 0
	mx = 0
	for t in range(z + 1):
		pos = k - 2 * t
		if pos < 0:
			continue
		mx = 0
		s = 0
		for i in range(pos + 1):
			if i < n - 1:
				mx = max(mx, a[i] + a[i + 1])
			s += a[i]
		ans = max(ans, s + mx * t)
	print(ans)


for i in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))[:k + 1]
	length = k + 1
	sums = [a[i] + a[i + 1] for i in range(len(a) - 1)]
	maxs = [sum(a)]
	try:
		for i in range(1, 1 + z):
			a.pop()
			a.pop()
			maxs.append(sum(a) + i * max(sums))
			sums.pop()
			sums.pop()
	except:
		pass
	print(max(maxs))


t = int(input())
for j in range(t):
	(n, k, z) = map(int, input().split())
	L = map(int, input().split())
	L = list(L)
	z = min(k // 2, z)
	A = L[:k + 1]
	if z == 0:
		print(sum(A))
	else:
		D = []
		D = D + [sum(A)]
		F = A[:k + 2 - z * 2]
		e = f = 0
		for i in range(k + 1 - z * 2):
			e = F[i] + F[i + 1]
			if e > f:
				f = e
		for y in range(1, z + 1):
			l = len(A)
			A = A[:l - 2]
			h = g = 0
			for i in range(len(F) - 1, len(A) - 1):
				g = A[i] + A[i + 1]
				if g > h:
					h = g
			if h > f:
				D = D + [sum(A) + h * y]
			else:
				D = D + [sum(A) + f * y]
		Z = L[:k]
		for i in range(1, z + 1):
			r = len(Z)
			D = D + [sum(Z[:r - 1]) + (Z[r - 1] + Z[r - 2]) * i]
			Z = Z[:r - 2]
		print(max(D))


t = int(input())
for _ in range(t):
	(n, k, z) = input().split()
	n = int(n)
	k = int(k)
	z = int(z)
	diyo = list(map(int, input().split()))
	adjesentsum = [diyo[0]]
	for index1 in range(1, k + 1):
		adjesentsum.append(adjesentsum[-1] + diyo[index1])
	T_pair = []
	for index1 in range(k):
		T_pair.append(diyo[index1] + diyo[index1 + 1])
	if z == 0:
		print(adjesentsum[-1])
	else:
		final_ans = adjesentsum[-1]
		for index1 in range(k):
			index2 = 1
			while -2 * index2 >= -k and index2 <= min(z, (k - index1) // 2):
				store = adjesentsum[-2 * index2 - 1]
				store += T_pair[index1] * index2
				if store > final_ans:
					final_ans = store
				index2 += 1
		print(final_ans)


import sys
import os
from io import BytesIO, IOBase

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def ddi():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from collections import deque
from math import gcd, pi
from bisect import bisect_left as bl
from bisect import bisect_right as br

def prefix_sum_array(a):
	n = len(a)
	pref = [0 for i in range(n)]
	pref[0] = a[0]
	for i in range(1, n):
		pref[i] = pref[i - 1] + a[i]
	return pref

def sum_between_ranges(pref, l, r):
	return pref[r] if l == 0 else pref[r] - pref[l - 1]
for _ in range(ii()):
	(n, k, z) = mi()
	a = li()
	ans = sum(a[:k + 1])
	pref = prefix_sum_array(a[:k + 1])
	for backwards in range(1, z + 1):
		mx = 0
		if k + 1 - 2 * backwards <= 0:
			break
		for i in range(k + 1 - 2 * backwards):
			mx = max(mx, a[i] + a[i + 1])
		ans = max(ans, mx * backwards + sum_between_ranges(pref, 0, k - backwards * 2))
	print(ans)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	b = [a[0]] * n
	c = [0] * n
	d = [0] * n
	m = a[0] + a[1]
	for j in range(1, k + 1):
		b[j] = b[j - 1] + a[j]
		c[j] = a[j - 1] + a[j]
		if c[j] >= m:
			d[j] = c[j]
			m = c[j]
		else:
			d[j] = m
	ans = b[k]
	for t in range(1, z + 1):
		pos = k - 2 * t
		if pos < 0:
			continue
		ans = max(ans, b[pos] + d[pos + 1] * t)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	lst = list(map(int, input().split()))
	sm = 0
	for i in range(0, z + 1):
		mx = 0
		ans = 0
		for x in range(0, k - 2 * i + 1):
			ans += lst[x]
			if x + 1 < len(lst):
				mx = max(mx, lst[x] + lst[x + 1])
		ans += i * mx
		sm = max(sm, ans)
	print(sm)


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		(n, k, z) = map(int, input().split())
		arr = list(map(int, input().split()))
		su = [0]
		for i in arr:
			su.append(su[-1] + i)
		fin = su[k + 1]
		for i in range(1, k):
			ans = su[i + 1]
			(K, Z) = (k - i, z)
			for _ in range(min(K // 2, z)):
				ans += arr[i - 1] + arr[i]
			Z -= min(K // 2, z)
			K -= min(K // 2, z) * 2
			if not K:
				fin = max(ans, fin)
			elif Z:
				fin = max(ans + arr[i - 1], ans + arr[i + 1], fin)
			else:
				fin = max(fin, ans + su[i + K + 1] - su[i + 1])
		print(fin)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for i in range(t):
	(n, k, l) = map(int, input().split())
	lissht = list(map(int, input().split()))
	pairsum = []
	for j in range(k):
		pairsum.append(lissht[j] + lissht[j + 1])
	max_k_sum = 0
	ans = 0
	su = 0
	for ki in range(l + 1):
		su = 0
		ma = sum(lissht[:k + 1])
		ans = max(ma, ans)
		k = k - 2
		try:
			su += max(pairsum) * ki
		except:
			break
		ans = max(ans, ma + su)
		if ki != 0:
			pairsum = pairsum[:-2]
		if k < 0:
			break
	print(ans)


import io
import os
DEBUG = False
inf = float('inf')

def pack(a, b, c):
	assert 0 <= c < 2
	assert 0 <= b < 8
	return (a << 4) + (b << 1) + c

def solve1(N, K, Z, A):
	cache = {}

	def dp(rightsUsed, leftsUsed, lastMoveIsLeft):
		key = pack(rightsUsed, leftsUsed, lastMoveIsLeft)
		if key not in cache:
			rightsUsed = moves - leftsUsed
			i = rightsUsed - leftsUsed
			best = -inf
			if not 0 <= i < N or rightsUsed + leftsUsed > K:
				best = -inf
			elif rightsUsed + leftsUsed == K:
				best = A[i]
			else:
				if i > 0 and lastMoveIsLeft == 0 and (leftsUsed < Z):
					best = max(best, A[i] + dp(rightsUsed, leftsUsed + 1, 1))
				if i < N - 1:
					best = max(best, A[i] + dp(rightsUsed + 1, leftsUsed, 0))
			cache[key] = best
		return cache[key]
	assert Z <= 5
	for moves in reversed(range(K + 1)):
		for leftsUsed in range(Z + 1):
			for lastMoveIsLeft in [0, 1]:
				rightsUsed = moves - leftsUsed
				dp(rightsUsed, leftsUsed, lastMoveIsLeft)
	return dp(0, 0, 0)

def solve2(N, K, Z, A):
	pref = [0]
	for x in A:
		pref.append(pref[-1] + x)
	maxAdjSum = [-inf, -inf]
	for (x, y) in zip(A, A[1:]):
		z = x + y
		maxAdjSum.append(max(maxAdjSum[-1], z))
	if DEBUG:
		for i in range(N + 1):
			B = A[:i]
			assert pref[i] == sum(B)
			assert maxAdjSum[i] == max((x + y for (x, y) in zip(B, B[1:])), default=-inf)
	best = -inf
	for lefts in range(Z + 1):
		rights = K - lefts
		if lefts > rights:
			continue
		paired = lefts
		maxReached = rights - paired + 1
		if maxReached > N:
			continue
		score = pref[maxReached] + maxAdjSum[min(N, maxReached + 1)] * paired
		best = max(best, score)
	return best
if DEBUG:
	import random
	random.seed(0)
	for _ in range(1000):
		N = random.randint(2, 100)
		K = random.randint(1, N - 1)
		Z = random.randint(0, min(5, K))
		A = [random.randint(1, 10 ** 4) for i in range(N)]
		ans1 = solve1(N, K, Z, A)
		ans2 = solve2(N, K, Z, A)
		if ans1 != ans2:
			print(ans1, ans2)
			print(N, K, Z, A)
			exit()
solve = solve1
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N, K, Z) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, K, Z, A)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = [int(x) for x in input().split()]
	ans = 0
	cs = 0
	qs = 0
	for i in range(z + 1):
		pos = k - 2 * i
		if pos < 0:
			continue
		cs = 0
		qs = 0
		for q in range(pos + 1):
			if q < n - 1:
				cs = max(cs, a[q] + a[q + 1])
			qs += a[q]
		ans = max(ans, qs + cs * i)
	print(ans)


from sys import stdin, stdout
input = stdin.readline
mp = lambda : map(int, input().split())
it = lambda : int(input())
for i in range(it()):
	(a, b, c) = mp()
	li = list(mp())
	ans = 0
	for j in range(c + 1):
		max_pos = b - 2 * j
		if max_pos >= 0:
			mx_2_ele = 0
			sm = 0
			for ele in range(max_pos + 1):
				if a - 1 - ele > 0:
					mx_2_ele = max(mx_2_ele, li[ele] + li[ele + 1])
				sm += li[ele]
			pair_sum = j * mx_2_ele
			ans = max(ans, sm + pair_sum)
	print(ans)


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for p in range(I()):
	(n, k, z) = R()
	a = L()
	v = [a[0]]
	for i in a[1:]:
		v += (i + v[-1],)
	ans = []
	for i in range(1, k + 1):
		mv = k - i
		j = min(mv, z * 2)
		ex = j % 2
		ans += ((a[i] + a[i - 1]) * ((j + 1) // 2) - a[i] * ex + v[k - j],)
	print(max(ans))


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	pref = [0] * n
	pref[0] = a[0]
	ans = a[0]
	for i in range(1, n):
		pref[i] = pref[i - 1] + a[i]
	for i in range(1, n):
		if k - i < 0:
			continue
		r = k - i
		l = min(k - i, 2 * z)
		t = l // 2
		temp = pref[i] + (a[i] + a[i - 1]) * t
		r -= t * 2
		if r > 0 and l & 1:
			if a[i + 1] > a[i - 1]:
				temp += a[i + 1]
				i += 1
			else:
				temp += a[i - 1]
				i -= 1
			r -= 1
		if r > 0:
			temp += pref[i + r] - pref[i]
		ans = max(ans, temp)
	print(ans)


t = int(input())
for _ in range(t):
	(n, k, z) = list(map(int, input().split(' ')))
	a = list(map(int, input().split(' ')))
	a_max = list(a)
	a_res = list(a)
	for i in range(1, n):
		a_res[i] += a_res[i - 1]
	if n > 1:
		a_max[0] = a[0] + a[1]
	for i in range(1, n - 1):
		a_max[i] = max(a_max[i - 1], a[i + 1] + a[i])
	res_max = 0
	for j in range(z + 1):
		fin = k - 2 * j
		if fin < 0:
			continue
		res = a_res[fin] + j * a_max[fin]
		res_max = max(res, res_max)
	print(res_max)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	B = [0 for i in range(n)]
	B[0] = A[0]
	for i in range(1, n):
		B[i] = A[i] + B[i - 1]
	ans = A[0]
	ans1 = A[0]
	for i in range(1, n):
		if k == 0:
			ans = max(ans, ans1)
			break
		k = k - 1
		ans1 = ans1 + A[i]
		ans2 = ans1
		v = k - 2 * z
		if v >= 0:
			ans2 = ans2 + z * (A[i - 1] + A[i]) + B[i + v] - B[i]
		else:
			v = k // 2
			if k % 2 == 0:
				ans2 = ans2 + v * (A[i - 1] + A[i])
			else:
				ans2 = ans2 + v * (A[i - 1] + A[i]) + A[i - 1]
		ans = max(ans, ans2)
	ans = max(ans, ans1)
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
	(n, k, z) = map(int, input().split())
	a = [int(i) for i in input().split() if i != '\n']
	pref = [a[0]]
	for i in range(1, n):
		pref.append(pref[-1] + a[i])
	ans = [pref[k]]
	left = 0
	for i in range(k - 1, 0, -1):
		if (k - 1 - i) % 2 == 0:
			left += 1
		left = min(left, z)
		if k - i & 1:
			ans.append(pref[i] + a[i - 1] * left + a[i] * (left - 1))
		else:
			ans.append(pref[i] + a[i - 1] * left + a[i] * left)
		if left >= z:
			pq = pref[i - 1]
			maxa = 0
			for j in range(i - 1):
				maxa = max(a[j] * z + a[j + 1] * z, maxa)
				ans.append(pq + maxa)
			break
	print(max(ans))


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	p = l[:]
	for i in range(1, n):
		p[i] += p[i - 1]
	ans = p[k]
	for i in range(n - 1):
		for j in range(z):
			tempans = p[i + 1]
			if i + 1 + 2 * (j + 1) > k:
				if i + 1 + 2 * (j + 1) - 1 == k:
					tempans += j * (l[i] + l[i + 1])
					tempans += l[i]
					ans = max(ans, tempans)
				continue
			tempans += (j + 1) * (l[i] + l[i + 1])
			effectivek = k - (i + 1) - 2 * (j + 1)
			tempans += p[i + 1 + effectivek] - p[i + 1]
			ans = max(ans, tempans)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	nums = [*map(int, input().split())]
	ans = 0
	for left in range(z + 1):
		endpos = k - 2 * left
		if endpos < 0:
			break
		(mx, s) = (0, 0)
		for i in range(endpos + 1):
			if i < n - 1:
				mx = max(mx, nums[i] + nums[i + 1])
			s += nums[i]
		ans = max(ans, s + left * mx)
	print(ans)


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	m = []
	for i in range(1, k + 1):
		m.append(a[i] + a[i - 1])
	m.append(-1)
	ma = -1
	sm = 0
	max_ans = 0
	for i in range(k + 1):
		ma = max(ma, m[i])
		sm += a[i]
		j = (k - i) // 2
		if i + 2 * j == k and j >= 0 and (j <= z):
			max_ans = max(max_ans, sm + j * ma)
	print(max_ans)


ans = []
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	u = list(map(int, input().split()))
	z = min(z, k // 2)
	x = k - 2 * z
	if x == 0:
		x = 1
	mx = 0
	for i in range(1, x + 1):
		mx = max(mx, u[i] + u[i - 1])
	for i in range(1, n):
		u[i] += u[i - 1]
	u.append(0)
	ansi = u[x]
	ansj = 0
	for i in range(x, k + 1):
		cur = u[i] + (k - i) // 2 * mx
		if (k - i) % 2 == 1:
			cur += u[i - 1] - u[i - 2]
		ansj = max(ansj, cur)
		if i < n - 1 and u[i + 1] - u[i - 1] > mx:
			mx = u[i + 1] - u[i - 1]
	ans.append(ansj)
print('\n'.join(map(str, ans)))


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = 0
	for t in range(z + 1):
		r = k - 2 * t
		if r < 0:
			continue
		m = 0
		s = 0
		for i in range(r + 1):
			if i < n - 1:
				temp = l[i + 1] + l[i]
				m = max(m, temp)
			s += l[i]
		ans = max(s + m * t, ans)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	if z == 0:
		print(sum(A[0:k + 1]))
	else:
		sum0 = A[0]
		sum0 += sum(A[1:k + 1])
		mxn = sum0
		for i in range(1, min(z + 1, k // 2 + 1)):
			mx = A[0] + A[1]
			for j in range(1, k - 2 * i + 1):
				mx = max(mx, A[j] + A[j - 1])
			val = A[k - 2 * i] + A[k - 2 * i + 1]
			mxn = max(mxn, sum(A[0:k - 2 * i + 1]) + i * mx, sum(A[0:k - 2 * i + 2]) + (i - 1) * val + A[k - 2 * i])
		print(mxn)


t = int(input())
for _ in range(t):
	a = [0]
	(n, k, z) = map(int, input().split())
	x = input().split()
	for i in x:
		a.append(int(i))
	Ma = float('-inf')
	M = [Ma, Ma]
	for i in range(2, k + 2):
		Ma = max(Ma, a[i] + a[i - 1])
		M.append(Ma)
	pre = [0, a[1]]
	for i in range(2, k + 2):
		pre.append(pre[-1] + a[i])
	Ma = float('-inf')
	for i in range(max(1, k + 1 - 2 * z), k + 2):
		if (k + 1 - i) % 2:
			poss = pre[i] + a[i - 1] + (k - i) * M[i] // 2
			Ma = max(Ma, poss)
		else:
			poss = pre[i] + (k - i + 1) * M[i] // 2
			Ma = max(Ma, poss)
	print(Ma)


def mi():
	return map(int, input().split())

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def si():
	return input().split()
t = ii()
for _ in range(t):
	(n, k, z) = mi()
	a = li()
	psum = [a[0]]
	for i in range(1, k + 1):
		psum.append(psum[-1] + a[i])
	if z == 0:
		print(psum[-1])
		continue
	ans = a[0]
	for i in range(1, k + 1):
		s = psum[i]
		total = k - i
		left = min(total // 2 + total % 2, z)
		right = total - left
		s += a[i - 1] * left + a[i] * (left - 1)
		right -= left - 1
		s += psum[i - 1 + right] - psum[i - 1]
		ans = max(ans, s)
	print(ans)


import math
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	lst = list(map(int, input().split()))
	su = [lst[0]]
	count = 0
	for i in range(1, k + 1):
		su.append(lst[i] + su[i - 1])
	if z == 0:
		print(su[k])
	else:
		ma = lst[k]
		for i in range(1, k + 1):
			a = min(k - i, z)
			if k - i > 2 * z:
				b = (lst[i] + lst[i - 1]) * a + su[k - 2 * a]
			else:
				c = int(math.floor((k - i) / 2))
				d = int(math.ceil((k - i) / 2))
				b = su[i] + lst[i] * c + lst[i - 1] * d
			if b > ma:
				ma = b
		print(ma)


def solve(n, k, z, a):
	answ = sum(a[:k + 1])
	for t in range(z + 1):
		max_sum = 0
		s = 0
		for i in range(k - 2 * t + 1):
			s1 = 0 if i + 1 >= len(a) else a[i + 1] + a[i]
			if s1 > max_sum:
				max_sum = s1
			s += a[i]
		if max_sum * t + s > answ:
			answ = max_sum * t + s
	print(answ)
t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	a = [int(j) for j in input().split()]
	solve(n, k, z, a)


def walk(arr, k, l):
	ans = 0
	for t in range(l + 1):
		mx = 0
		temp = 0
		if k - 2 * t < 0:
			continue
		for j in range(0, k - 2 * t + 1):
			if j < len(arr) - 1:
				mx = max(mx, arr[j] + arr[j + 1])
			temp += arr[j]
		ans = max(ans, temp + t * mx)
	return ans
a = int(input())
for i in range(a):
	(a, b, c) = map(int, input().strip().split())
	lst = list(map(int, input().strip().split()))
	print(walk(lst, b, c))


import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	pfsums = [0 for i in range(n)]
	pfsums[0] = a[0]
	for i in range(1, n):
		pfsums[i] = a[i] + pfsums[i - 1]
	pfMaxPair = [0 for i in range(n)]
	for i in range(1, n):
		pfMaxPair[i] = max(pfMaxPair[i - 1], a[i - 1] + a[i])
	ans = 0
	for left in range(z + 1):
		if left > k // 2:
			break
		lastIdx = k - 2 * left
		ans = max(ans, pfsums[lastIdx] + pfMaxPair[lastIdx] * left)
		if left > 0:
			ans = max(ans, pfsums[lastIdx + 1] + pfMaxPair[lastIdx + 1] * (left - 1) + a[lastIdx])
	print(ans)


import heapq
import collections
from math import log2
import itertools
from functools import lru_cache
from sys import setrecursionlimit as srl
srl(2 * 10 ** 6)
N = 200001

def solve(n, k, z, a):
	ps = [0]
	ans = 0
	sco = 0
	for i in range(1, n + 1):
		ps.append(ps[-1] + a[i])
	for i in range(2, n + 1):
		req = i - 1
		if req > k:
			break
		rem = k - req
		tot = min(rem, 2 * z)
		x = a[i] + a[i - 1]
		sco = tot // 2 * x + tot % 2 * a[i - 1]
		sco += ps[i]
		rem -= tot
		sco += ps[i + rem] - ps[i]
		ans = max(ans, sco)
	return ans
t = int(input())
for _ in range(1, t + 1):
	(n, k, z) = map(int, input().split())
	a = [0]
	in_ = map(int, input().split())
	for x in in_:
		a.append(x)
	print(solve(n, k, z, a))


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = 0
	max_s = 0
	s = 0
	for i in range(z + 1):
		pos = k - 2 * i
		if pos < 0:
			continue
		max_s = 0
		s = 0
		for j in range(pos + 1):
			if j < n - 1:
				max_s = max(max_s, l[j] + l[j + 1])
			s += l[j]
		ans = max(ans, s + max_s * i)
	print(ans)


from itertools import count
import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def output(*args):
	sys.stdout.buffer.write(('\n'.join(map(str, args)) + '\n').encode('utf-8'))

def main():
	t = int(input())
	ans_a = [''] * t
	for ti in range(t):
		(n, k, z) = map(int, input().split())
		a = list(map(int, input().split())) + [0]
		dp = [[0] * (z + 1) for _ in range(n)]
		ans = dp[0][0] = a[0]
		for i in range(1, k + 1):
			for j in range(z + 1):
				if i + j * 2 > k:
					break
				dp[i][j] = max(dp[i][j], dp[i - 1][j] + a[i])
				if j < z and i + j * 2 + 2 <= k:
					dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + a[i - 1] + a[i])
				if j < z and i + j * 2 + 1 <= k:
					ans = max(ans, dp[i][j] + a[i - 1])
			ans = max(ans, max(dp[i]))
		ans_a[ti] = str(ans)
	output(*ans_a)
main()


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def pref(a, n, f):
	pre = [0] * n
	if f == 0:
		pre[0] = a[0]
		for i in range(1, n):
			pre[i] = a[i] + pre[i - 1]
	else:
		pre[-1] = a[-1]
		for i in range(n - 2, -1, -1):
			pre[i] = pre[i + 1] + a[i]
	return pre
for _ in range(inin()):
	(n, k, z1) = cin()
	l = ain()
	pre = pref(l, n, 0)
	ans = pre[k]
	k -= 1
	for i in range(1, n):
		if k == 0:
			break
		z = min(k, z1 * 2)
		ans = max(ans, (l[i] + l[i - 1]) * (z // 2) + l[i - 1] * (z % 2) + pre[i + k - z])
		k -= 1
	print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	for j in range(int(input())):
		(n, k, z) = map(int, input().split())
		vals = list(map(int, input().split()))
		dict1 = {}
		maxy = vals[0] + vals[1]
		prefsum = []
		sum1 = 0
		for s in range(min(n, k + 1)):
			if s < n - 1:
				if vals[s] + vals[s + 1] > maxy:
					maxy = vals[s] + vals[s + 1]
				dict1[s] = maxy
			sum1 += vals[s]
			prefsum.append(sum1)
		maxsofar = 0
		for s in range(z + 1):
			right = k - s
			left = s
			total = prefsum[right - left]
			if right >= left and left != 0:
				total += dict1[right - left] * left
			if total > maxsofar:
				maxsofar = total
		print(maxsofar)
main()


t = int(input())
for s in range(t):
	(n, m, k) = map(int, input().split())
	b = list(map(int, input().split()))
	m += 1
	dp = [[0 for i in range(m + 1)] for j in range(k + 1)]
	b = [0] + b
	add = 0
	for i in range(1, m + 1):
		dp[0][i] = b[i] + add
		add += b[i]
	maxi = dp[0][m]
	for i in range(1, k + 1):
		for j in range(1, m + 1):
			if 2 * i + j > m:
				maxi = max(maxi, dp[i][j - 1])
				break
			dp[i][j] = max(dp[i][j - 1], dp[i - 1][j + 1]) + b[j]
	print(maxi)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	C = [0] * n
	S = [0] * n
	S[0] = A[0]
	for i in range(1, n):
		C[i] = max(C[i - 1], A[i] + A[i - 1])
		S[i] = S[i - 1] + A[i]
	ans = -10 ** 18
	for i in range(z + 1):
		r = k - 2 * i
		if r < 0:
			continue
		temp = S[r] + C[r] * i
		ans = max(ans, temp)
		if r + 1 < n:
			temp = S[r + 1] + C[r + 1] * (i - 1) + A[r]
			ans = max(ans, temp)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = [int(i) for i in input().split()]
	maxx = 0
	p = []
	for i in range(z + 1):
		r = k + 1 - 2 * i
		ans = 0
		maxx = 0
		for j in range(r):
			if j + 1 < n:
				maxx = max(maxx, a[j] + a[j + 1])
			ans += a[j]
		p.append(ans + maxx * i)
	print(max(p))


import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)

def solve(arr, k, z):
	pre = [0]
	for i in arr:
		pre.append(pre[-1] + i)
	ans = 0
	for i in range(1, len(arr)):
		moves = k - i
		s = pre[i]
		left = min(z * 2, moves)
		s += (arr[i] + arr[i - 1]) * (left // 2) + left % 2 * arr[i - 1]
		movesleft = moves - left
		s += pre[i + movesleft + 1] - pre[i]
		ans = max(ans, s)
	return ans
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))[:k + 1]
	print(solve(arr, k, z))


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	sc = []
	sums = 0
	for i in range(n):
		sums += a[i]
		sc.append(sums)
	b = []
	for i in range(1, k + 1):
		cnt = k - i
		if cnt % 2 == 0:
			if z >= cnt // 2:
				ans = cnt // 2 * (a[i] + a[i - 1])
				cnt = 0
				ans += sc[i]
			else:
				ans = z * (a[i] + a[i - 1])
				cnt -= 2 * z
				ans += sc[i + cnt]
		elif z >= cnt // 2 + 1:
			ans = cnt // 2 * (a[i] + a[i - 1])
			if i != n - 1:
				ans += max(a[i - 1], a[i + 1])
			else:
				ans += a[i - 1]
			cnt = 0
			ans += sc[i]
		else:
			ans = z * (a[i] + a[i - 1])
			cnt -= 2 * z
			ans += sc[i + cnt]
		b.append(ans)
	print(max(b))


import re
t = int(input())
for _ in range(t):
	(n, k, z) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	maxsum = 0
	if k == 0:
		print(0)
		continue
	if z == 0:
		print(sum(arr[:k + 1]))
		continue
	if n == 1:
		print(arr[0])
		continue
	else:
		for i in range(z + 1):
			res = 0
			maxback = 0
			for j in range(k - 2 * i + 1):
				res += arr[j]
				if j < n - 1 and maxback < arr[j] + arr[j + 1]:
					maxback = arr[j] + arr[j + 1]
			res += i * maxback
			if res > maxsum:
				maxsum = res
		print(maxsum)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	b = a[:k + 1]
	score = sum(b)
	y = len(b)
	c = []
	for i in range(0, k):
		c.append(a[i] + a[i + 1])
	for i in range(1, z + 1):
		x = y - 2 * i
		if x < 0:
			break
		sum1 = sum(a[:x])
		if x > 0:
			sum2 = max(c[:x])
		else:
			sum2 = 0
		score = max(score, sum1 + sum2 * i)
	print(score)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	sum = []
	two = []
	for i in range(n):
		if i == 0:
			sum.append(a[i])
			two.append(0)
		else:
			sum.append(sum[i - 1] + a[i])
			two.append(max(two[i - 1], a[i - 1] + a[i]))
	res = 0
	for i in range(1, k + 1):
		if int((k - i) / 2) <= z:
			val = sum[i] + int((k - i) / 2) * two[i]
			if (k - i) % 2 == 1 and int((k - i) / 2) + 1 <= z:
				val += a[i - 1]
			res = max(res, val)
	print(res)


(q,) = map(int, input().split())
for _ in range(q):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	sa = []
	pa = []
	l = 0
	for (i, c) in enumerate(arr):
		l += c
		sa.append(l)
		if i:
			pa.append(c + arr[i - 1])
			if len(pa) > 1:
				pa[-1] = max(pa[-1], pa[-2])
	ans = 0
	for i in range(min(z, k // 2) + 1):
		t1 = sa[k - 2 * i]
		if i:
			t1 += i * pa[k - 2 * i]
		ans = max(ans, t1)
	print(ans)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split())) + [0]
	s = list(a)
	for i in range(n - 1):
		s[i + 1] += s[i]
	mx = 0
	v = [0] * n
	for i in range(n):
		mx = max(mx, a[i] + a[i + 1])
		v[i] = mx
	ans = 0
	for i in range(0, min(z * 2, k) + 1, 2):
		j = k - i
		x = s[j] + i // 2 * v[j]
		ans = max(ans, x)
	print(ans)


from sys import stdin
input = stdin.readline

def help():
	(n, k, z) = map(int, input().split(' '))
	k += 1
	arr = list(map(int, input().split(' ')))
	maxyet = [0]
	for i in range(1, n):
		maxyet.append(max(arr[i] + arr[i - 1], maxyet[-1]))
	ans = sum(arr[:k])
	for i in range(1, z + 1):
		left = 2 * i
		if k - left - 1 >= 0:
			ans = max(sum(arr[:k - left + 1]) + arr[k - left - 1], ans)
		if k - left > 0:
			ans = max(ans, i * maxyet[k - left] + sum(arr[:k - left]))
	print(ans)
for _ in range(int(input())):
	help()


import math
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	array = list(map(int, input().split()))
	m = []
	ans = 0
	prefix = array[:]
	for i in range(1, len(array)):
		prefix[i] += prefix[i - 1]
	for i in range(1, min(k + 1, len(array))):
		if m == [] or array[i] + array[i - 1] > sum(m) or (array[i] + array[i - 1] == sum(m) and array[i - 1] > m[0]):
			m = [array[i - 1], array[i]]
			steps = k
			temp = 0
			steps -= i
			temp += prefix[i]
			if steps < 0:
				break
			if math.ceil(steps / 2) <= z:
				temp += m[0] * math.ceil(steps / 2)
				temp += m[1] * (steps // 2)
			else:
				temp += sum(m) * z
				steps -= 2 * z
				temp -= prefix[i]
				temp += prefix[min(len(array) - 1, i + steps)]
			ans = max(ans, temp)
	print(ans)


def max_backsteps(index, moves, z):
	return min((moves - index) // 2, z)

def calc(a, z):
	partial_sums = list()
	s = 0
	for item in a:
		s += item
		partial_sums.append(s)
	moves = len(a) - 1
	best_sum = partial_sums[-1]
	for i in range(len(a) - 2):
		backsteps = max_backsteps(i, moves, z)
		remaining_moves = moves - i - 2 * backsteps
		s = partial_sums[i] + (a[i] + a[i + 1]) * backsteps + partial_sums[i + remaining_moves] - partial_sums[i]
		best_sum = max(best_sum, s)
	return best_sum

def get_ints():
	return [int(n) for n in input().split()]

def get_floats():
	return [float(n) for n in input().split()]

def seq2str(seq):
	return ' '.join((str(item) for item in seq))
a = get_ints()
assert len(a) == 1
t = a[0]
for i in range(t):
	a = get_ints()
	assert len(a) == 3
	(n, k, z) = (a[0], a[1], a[2])
	a = get_ints()
	assert len(a) == n
	res = calc(a[:k + 1], z)
	print(res)


import math, sys
from collections import defaultdict, deque
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')

def I():
	return int(sys.stdin.readline())

def In():
	return map(int, sys.stdin.readline().split())

def Sn():
	return sys.stdin.readline().strip()

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		(n, k, z) = In()
		l = list(In())
		mx = 0
		pre = []
		for i in range(n):
			mx += l[i]
			pre.append(mx)
		mx = pre[0 + k]
		k -= 1
		for i in range(1, n):
			(cntz, cntk, q) = (z, k, 1)
			ans = pre[i]
			while cntk > 0 and cntz > 0:
				if q & 1:
					ans += l[i - 1]
					cntz -= 1
				else:
					ans += l[i]
				q += 1
				cntk -= 1
			if q & 1 != 1:
				ans += l[i]
				cntk -= 1
			if cntk:
				ans += pre[i + cntk] - pre[i]
			mx = max(mx, ans)
			k -= 1
		print(mx)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	m = 0
	for left in range(z + 1):
		if k - 2 * left + 1 >= 0:
			temp = 0
			for j in range(k - 2 * left + 1):
				if j + 1 < n and a[j] + a[j + 1] > temp:
					temp = a[j] + a[j + 1]
			m = max(m, sum(a[:k - 2 * left + 1]) + left * temp)
	print(m)


t = int(input())
while t:
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	su = 0
	mx = 0
	for tc in range(z + 1):
		pos = k - 2 * tc
		if pos < 0:
			continue
		mx = 0
		su = 0
		for i in range(pos + 1):
			if i < n - 1:
				mx = max(mx, a[i] + a[i + 1])
			su += a[i]
		ans = max(ans, su + mx * tc)
	print(ans)
	t -= 1


import sys
T = int(sys.stdin.readline().strip())
for t in range(0, T):
	(n, k, z) = list(map(int, sys.stdin.readline().strip().split()))
	a = list(map(int, sys.stdin.readline().strip().split()))
	b = [0] * n
	c = [0] * n
	c[0] = a[0]
	d = [0] * n
	d[0] = a[0] + a[1]
	for i in range(1, n):
		b[i - 1] = a[i] + a[i - 1]
		c[i] = c[i - 1] + a[i]
	for i in range(1, n):
		d[i] = max(d[i - 1], b[i])
	s = a[0]
	m = b[0]
	ans = 0
	i = z
	while i >= 0:
		if 2 * i <= k:
			ans = max(ans, c[k - 2 * i] + i * d[k - 2 * i])
		i = i - 1
	print(ans)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(n, k, z) = int_array()
	a = int_array()
	ans = 0
	score = 0
	for i in range(k + 1):
		score += a[i]
	ans = max(score, ans)
	if z == 0:
		print(ans)
		continue
	i = k
	for x in range(1, z + 1):
		score -= a[i] + a[i - 1]
		i -= 2
		mx = NINF
		for p in range(i + 1):
			mx = max(mx, a[p] + a[p + 1])
		ans = max(score + x * mx, ans)
	print(ans)


import math
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	arr = [0 for i in range(n)]
	arr[0] = l[0]
	s = sum(l[0:k])
	for i in range(1, n):
		arr[i] = l[i] + arr[i - 1]
	ans = 1
	a = arr[k]
	for i in range(n - 1):
		c = l[i]
		nex = l[i + 1]
		t = l[i] + l[i + 1]
		cilo = {i: 1 for i in range(1)}
		peelo = ['str']
		cs = arr[i]
		kilo = k - i
		if z > 0:
			if kilo > 0 and 2 * z <= kilo:
				cs += t * z
				kilo -= 2 * z
				cmd = 100
			else:
				d = kilo // 2
				if kilo > 0 and kilo % 2 == 0:
					cs += t * d
					kilo = 0
					cid = 'asdfasdf'
				elif kilo > 0:
					cs += t * d
					if i + 1 < n:
						cs += l[i + 1]
					kilo = 0
		watt = [0 for i in range(10)]
		if kilo > 0:
			cs += arr[i + kilo] - arr[i]
		if i < k:
			s = max(s, cs)
	print(s)


def solve(nums, n, k, z):
	ans = 0
	for t in range(z + 1):
		pos = k - 2 * t
		if pos < 0:
			break
		cur_sum = 0
		max_trip = 0
		for i in range(pos + 1):
			cur_sum += nums[i]
			if i + 1 < n:
				max_trip = max(max_trip, nums[i] + nums[i + 1])
		ans = max(ans, cur_sum + max_trip * t)
	return ans
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	nums = [int(x) for x in input().split()]
	print(solve(nums, n, k, z))


for i in range(int(input())):
	(n, k, z) = map(int, input().split())
	nums = [*map(int, input().split())]
	ans = 0
	for leftnum in range(z + 1):
		endPos = k - 2 * leftnum
		if endPos < 0:
			break
		(mx, s) = (0, 0)
		for i in range(endPos + 1):
			if i < n - 1:
				mx = max(mx, nums[i] + nums[i + 1])
			s += nums[i]
		ans = max(ans, s + mx * leftnum)
	print(ans)


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	k += 1
	(*a,) = map(int, input().split())
	ans = sum(a[:k])
	s = a[0]
	pref = [0] * (n + 1)
	for i in range(n):
		pref[i] = pref[i - 1] + a[i]
	for i in range(1, n):
		s += a[i]
		if i + 1 > k:
			break
		tmp = s + a[i - 1] * min(z, (k - i) // 2) + a[i] * min(z, (k - i - 1) // 2)
		if k - i - 1 - 2 * z > 0:
			x = k - i - 1 - 2 * z
			tmp += pref[i + x] - pref[i]
		ans = max(ans, tmp)
	print(ans)


t = int(input())
for i in range(t):
	(n, k, z) = input().split()
	n = int(n)
	k = int(k)
	z = int(z)
	arr = input().split()
	arr = list(map(int, arr))
	best = []
	for i in range(len(arr) - 1):
		best.append(arr[i] + arr[i + 1])
	for i in range(1, len(best)):
		best[i] = max(best[i], best[i - 1])
	best.append(best[-1])
	highest = 0
	for left in range(z + 1):
		rightedge = k - 2 * left
		if rightedge < 0:
			continue
		current = sum(arr[:rightedge + 1]) + left * best[rightedge]
		if current > highest:
			highest = current
	print(highest)


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def solve():
	(n, k, z) = idata()
	data = idata()
	ans = sum(data[:k + 1])
	for g in range(1, z + 1):
		mx = 0
		if k + 1 - 2 * g <= 0:
			break
		for i in range(k + 1 - 2 * g):
			mx = max(mx, data[i] + data[i + 1])
		ans = max(ans, sum(data[:k + 1 - g * 2]) + mx * g)
	print(ans)
	return
for t in range(int(ii())):
	solve()


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	sm = [0] * n
	best = [0] * n
	for i in range(n):
		sm[i] = (0 if i == 0 else sm[i - 1]) + a[i]
	for i in range(1, n):
		cur = a[i] + a[i - 1]
		best[i] = max(best[i - 1], cur)
	ans = sm[k]
	for b in range(1, z + 1):
		f = k - 2 * b
		if f < 0:
			break
		if b == 0:
			cur = sm[f]
		else:
			cur = sm[f] + best[f + 1] * b
		ans = max(cur, ans)
	print(ans)


for _ in range(int(input())):
	temp = input().split(' ')
	(n, k, z) = (int(temp[0]), int(temp[1]), int(temp[2]))
	a = [int(x) for x in input().split()]
	ans = 0
	for i in range(z + 1):
		pos = k - 2 * i
		if pos < 0:
			continue
		mx = 0
		total = 0
		for j in range(pos + 1):
			if j < n - 1:
				mx = max(mx, a[j] + a[j + 1])
			total += a[j]
		ans = max(ans, total + mx * i)
	print(ans)


def main():
	for _ in range(int(input())):
		(n, k, z) = map(int, input().split())
		a = list(map(int, input().split()))
		ans = 0
		mx = 0
		s = 0
		for t in range(z + 1):
			pos = k - 2 * t
			if pos < 0:
				continue
			mx = 0
			s = 0
			for i in range(pos + 1):
				if i < n - 1:
					mx = max(mx, a[i] + a[i + 1])
				s += a[i]
			ans = max(ans, s + mx * t)
		print(ans)
main()


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(N, K, Z) = [int(x) for x in input().split()]
		A = [int(x) for x in input().split()]
		ruiseki = [A[0]]
		for i in range(1, N):
			ruiseki.append(ruiseki[-1] + A[i])
		ans = ruiseki[K]
		for i in range(1, K + 1):
			for j in range(min(-(-(K - i) // 2), Z)):
				ans = max(ans, A[i] + ruiseki[K - (j + 1) * 2] + (j + 1) * A[i - 1] + j * A[i])
		print(ans)
main()


t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	(n, k, z) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [0] * n
	b[0] = a[0]
	for i in range(1, n):
		b[i] = b[i - 1] + a[i]
	res = 0
	count = 0
	tmp = 0
	for i in range(1, min(k + 1, n)):
		curr = k
		if i:
			tmp = b[i - 1]
		curr -= i - 1
		div = min(2 * z, curr)
		tmp += (a[i] + a[i - 1]) * (div // 2)
		curr -= div // 2 * 2
		if curr > 0:
			tmp += b[i + curr - 1] - b[i - 1]
		if tmp > res:
			res = tmp
	print(res)


from math import ceil
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	s = [a[0]] * n
	for i in range(1, n):
		s[i] = s[i - 1] + a[i]
	val = []
	for i in range(1, k + 1):
		if k - i == 2 * z:
			val.append(s[i] + z * (a[i - 1] + a[i]))
		elif k - i < 2 * z:
			x = k - i
			val.append(s[i] + ceil(x / 2) * a[i - 1] + x // 2 * a[i])
		else:
			x = k - i - 2 * z
			val.append(s[i + x] + z * (a[i - 1] + a[i]))
	print(max(val))


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for y in range(z + 1):
		if k - 2 * y >= 0:
			summ = 0
			madj = 0
			for i in range(k - 2 * y + 1):
				summ += a[i]
				if i + 1 < n:
					madj = max(madj, a[i] + a[i + 1])
			summ += y * madj
			ans = max(ans, summ)
	print(ans)


import math
num_cases = int(input())
for _ in range(num_cases):
	(n, k, z) = list(map(int, input().strip().split()))
	arr = list(map(int, input().strip().split()))
	max_sums = []
	sums = []
	max_pair = 0
	running_sum = 0
	for i in range(n - 1):
		max_pair = max(max_pair, arr[i] + arr[i + 1])
		max_sums.append(max_pair)
		running_sum += arr[i]
		sums.append(running_sum)
	sums.append(running_sum + arr[n - 1])
	max_ans = 0
	num_left_allowed = min(z, int(k / 2))
	for t in range(num_left_allowed + 1):
		ans = sums[k - 2 * t]
		if t > 0:
			ans += t * max_sums[k - 2 * t]
		max_ans = max(max_ans, ans)
	print(max_ans)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for t in range(z + 1):
		cnt = k - 2 * t
		mp = 0
		s = 0
		for i in range(cnt + 1):
			s += a[i]
			if i + 1 < n:
				mp = max(mp, a[i] + a[i + 1])
		ans = max(ans, s + mp * t)
	print(ans)


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	(n, k, z) = nm()
	a = nl()
	b = [0] * (n + 1)
	c = [0] * (n + 1)
	for i in range(n):
		b[i + 1] = b[i] + a[i]
	for i in range(1, n):
		c[i] = max(c[i - 1], a[i - 1] + a[i])
	ans = 0
	for i in range(z + 1):
		if k - 2 * i < 0:
			break
		cur = b[1 + k - 2 * i] + i * c[k - 2 * i + 1]
		ans = max(ans, cur)
	print(ans)
	return
T = ni()
for _ in range(T):
	solve()


from math import ceil, floor
t = int(input())
while t > 0:
	(n, k, x) = map(int, input().split())
	a = list(map(int, input().split()))
	s = []
	su = 0
	for i in range(k + 1):
		s.append(su + a[i])
		su += a[i]
	l = s[k]
	for i in range(1, k + 1):
		f = min(k - i, 2 * x)
		safe = s[i] + ceil(f / 2) * a[i - 1] + floor(f / 2) * a[i]
		if k - i != f:
			safe += s[k - 2 * x] - s[i]
		if safe > l:
			l = safe
	print(l)
	t = t - 1


from math import *
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for i in range(z + 1):
		p = k - 2 * i
		if p < 0:
			break
		m = 0
		s = 0
		for j in range(p + 1):
			if j < n - 1:
				m = max(m, a[j] + a[j + 1])
			s = s + a[j]
		ans = max(ans, s + m * i)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	b = list(map(int, input().split()))
	sm = []
	s = sum(b[:k + 1])
	z1 = max(1, k - 2 * z)
	s1 = sum(b[:z1 + 1])
	sm.append(s)
	for i in range(1, k + 1):
		m = min((k - i + 1) // 2, z)
		m1 = min((k - i) // 2, z)
		cs = s1 + m * b[i - 1] + m1 * b[i]
		if i > z1:
			cs = cs + sum(b[z1 + 1:i + 1])
		sm.append(cs)
	print(max(sm))


num = int(input())
result = []
for i in range(num):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	psum = []
	s = 0
	for i in range(n):
		s += l[i]
		psum.append(s)
	if z == 0:
		result.append(psum[k])
	else:
		asum = []
		for i in range(n - 1):
			x = l[i] + l[i + 1]
			asum.append(x)
		optimal = []
		for i in range(z + 1):
			zval = i
			if k - 2 * zval >= 0:
				ans = psum[k - 2 * zval] + zval * max(asum[:k - 2 * zval + 1])
				optimal.append(ans)
		result.append(max(optimal))
for i in result:
	print(i)


for _ in range(int(input())):
	(n, k, z) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	pref = []
	s = 0
	for i in range(n):
		s += arr[i]
		pref.append(s)
	ans = [pref[k]]
	for i in range(1, k + 1):
		ansNow = pref[i]
		byRotating = 0
		haveMoreSteps = k - i
		stopInd = i
		if (k - i) // 2 < z:
			byRotating = (arr[i - 1] + arr[i]) * ((k - i) // 2)
			haveMoreSteps -= (k - i) // 2 * 2
			if k - i & 1:
				haveMoreSteps -= 1
				byRotating += arr[i - 1]
				stopInd = i - 1
		else:
			byRotating = (arr[i - 1] + arr[i]) * z
			haveMoreSteps -= z * 2
		ansNow += byRotating
		ansNow += pref[i + haveMoreSteps] - pref[i]
		ans.append(ansNow)
	print(max(ans))


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [(ch, len(list(g))) for (ch, g) in groupby(it)]

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None
t = N()
for i in range(t):
	(n, k, z) = RL()
	a = RLL()
	b = [a[i] + a[i + 1] for i in range(n - 1)]
	ans = tmp = sum(a[:k + 1])
	c = [b[0]]
	for i in range(n - 2):
		c.append(max(c[-1], b[i + 1]))
	for i in range(1, z + 1):
		if k >= i * 2:
			tmp -= a[k - i * 2 + 2] + a[k - 2 * i + 1]
			cur = tmp + c[k - 2 * i] * i
			ans = max(ans, cur)
		else:
			break
	print(ans)


from itertools import accumulate

def max_score(a, n, k, z):
	combined = [a[i] + a[i + 1] for i in range(k - 1)]
	cumsum = list(accumulate(a))
	max_so_far = cumsum[k]
	for i in range(z + 1):
		if k - 2 * i >= 0:
			(mx, s) = (0, 0)
			for j in range(k - 2 * i + 1):
				if j < n - 1:
					mx = max(mx, a[j] + a[j + 1])
				s += a[j]
			max_so_far = max(max_so_far, cumsum[k - 2 * i] + mx * i)
	print(max_so_far)
t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	max_score(a, n, k, z)


import sys
from itertools import accumulate

def main():
	t = int(sys.stdin.readline())
	for _ in range(t):
		(n, k, z) = [int(x) for x in sys.stdin.readline().split(' ')]
		a = [int(x) for x in sys.stdin.readline().split(' ')]
		prefix = list(accumulate(a))
		best = 0
		for t in range(z + 1):
			rightMoves = k - 2 * t
			if rightMoves < 0:
				break
			bestPairSum = a[0] + a[1]
			s = 0
			for i in range(0, min(rightMoves + 1, n - 1)):
				bestPairSum = max(bestPairSum, a[i] + a[i + 1])
			best = max(best, prefix[rightMoves] + t * bestPairSum)
		print(best)
main()


t = int(input())
for _ in range(t):
	(n, k, z) = [int(s) for s in input().split()]
	arr = [int(s) for s in input().split()]
	pref = [0] * (n + 1)
	for i in range(n):
		pref[i + 1] = pref[i] + arr[i]
	ans = pref[k + 1]
	z = min(z, k // 2)
	for t in range(1, z + 1):
		cand = pref[k + 1 - 2 * t]
		best = 0
		for i in range(k + 1 - 2 * t):
			best = max(best, arr[i] + arr[i + 1])
		ans = max(ans, cand + best * t)
	print(ans)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	if k <= 1:
		ans = sum(a[:k + 1])
	else:
		i = (k + 1) % 2
		if i == 0:
			i = 2
		x = sum(a[:i])
		if (k + 1) % 2 == 0:
			m = a[0] + a[1]
		else:
			m = max(a[0] + a[1], a[1] + a[2])
		ans = 0
		while True:
			j = (k + 1 - i) // 2
			if i == k + 1:
				ans = max(ans, x + m * j)
				break
			m = max(m, a[i - 1] + a[i], a[i] + a[i + 1])
			if j <= z:
				ans = max(ans, x + m * j)
			x += a[i] + a[i + 1]
			i += 2
	print(ans)


t = int(input())
while t:
	t += -1
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = 0
	cmsm = [0] * n
	cmsm[0] = l[0]
	for i in range(1, n):
		cmsm[i] = l[i] + cmsm[i - 1]
	for i in range(1, k + 1):
		left = k - i
		tmp = min(left, z * 2)
		left -= tmp
		sm = cmsm[i + left] + l[i] * (tmp // 2) + l[i - 1] * (tmp - tmp // 2)
		ans = max(ans, sm)
	print(ans)


import sys
import heapq

def main():
	t = int(input())
	for _ in range(t):
		(n, k, z) = map(int, sys.stdin.readline().split())
		nums = list(map(int, sys.stdin.readline().split()))
		sortedNums = nums[:]
		sortedNums.sort()
		twoSumList = []
		summedNums = [nums[0]]
		for i in range(n - 1):
			twoSumList.append([nums[i] + nums[i + 1], i])
			summedNums.append(summedNums[-1] + nums[i + 1])
		twoSumList.sort()
		ans = 0
		for sumVal in reversed(twoSumList):
			i = sumVal[1] + 1
			if i > k:
				ans = max(ans, summedNums[k])
				continue
			tempAns = summedNums[i]
			tempK = k - i
			if (tempK + 1) // 2 <= z:
				tempAns += tempK % 2 * nums[i - 1] + sumVal[0] * (tempK // 2)
			else:
				tempAns += sumVal[0] * z
				tempK -= 2 * z
				tempAns += summedNums[i + tempK] - summedNums[i]
			ans = max(ans, tempAns)
		print(ans)
	return
main()


def main():
	(n, k, m) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	mx = 0
	add = 0
	for j in range(m + 1):
		position = k - 2 * j
		if position < 0:
			continue
		mx = 0
		add = 0
		for i in range(position + 1):
			if i < n - 1:
				mx = max(mx, a[i] + a[i + 1])
			add += a[i]
		ans = max(ans, add + mx * j)
	print(ans)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
	return
test()


tt = int(input())
for _ in range(tt):
	(n, k, z) = [int(x) for x in input().split(' ')]
	arr = [int(x) for x in input().split(' ')]
	(m, ans, y) = (0, 0, 0)
	for t in range(z + 1):
		p = k - 2 * t
		(m, s) = (0, 0)
		if p < 0:
			continue
		for i in range(p + 1):
			s += arr[i]
			if i < n - 1:
				m = max(m, arr[i] + arr[i + 1])
		s += t * m
		ans = max(ans, s)
	print(ans)


for test in range(int(input())):
	(n, k, z) = map(int, input('').split())
	A = list(map(int, input('').split()))
	ans = 0
	prefix = [A[0]]
	for i in range(1, n):
		prefix.append(prefix[-1] + A[i])
	if z == 0:
		print(prefix[k])
		continue
	best = 0
	ans = 0
	i = 0
	temp = k
	while i < n - 1 and k >= 0:
		ans = prefix[i]
		ans += min(z, k // 2) * (A[i] + A[i + 1])
		k -= min(2 * z, 2 * (k // 2))
		if k >= 0:
			ans += prefix[k + i] - prefix[i]
			k = temp
		best = max(ans, best)
		i += 1
		k -= 1
		temp = k
	print(best)


T = int(input())
for _ in range(T):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	maxi = 0
	cumm_sum = [a[0]]
	for i in range(1, k + 1):
		cumm_sum.append(cumm_sum[-1] + a[i])
	pairs = []
	for i in range(k):
		pairs.append(a[i] + a[i + 1])
	if z == 0:
		print(cumm_sum[-1])
	else:
		ans = cumm_sum[-1]
		for i in range(k):
			j = 1
			while j <= min(z, (k - i) / 2) and -2 * j >= -k:
				temp = cumm_sum[-2 * j - 1]
				temp += pairs[i] * j
				if temp > ans:
					ans = temp
				j += 1
		print(ans)


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write('\n'.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from fractions import Fraction
INF = float('inf')
mod = int(1000000000.0) + 7
for t in range(int(data())):
	(n, k, z) = mdata()
	a = mdata()
	m = [0]
	s = [a[0]]
	for i in range(1, k + 1):
		m.append(max(m[-1], a[i - 1] + a[i]))
		s.append(a[i] + s[-1])
	ans = s[-1]
	for i in range(1, z + 1):
		if k - 2 * i < 0:
			break
		ans = max(ans, s[k - 2 * i] + m[k - 2 * i + 1] * i)
	out(ans)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	x = sum(a[:k + 1])
	if z == 0:
		print(x)
		continue
	s = [0] * (z + 1)
	s[0] = x
	for i in range(1, z + 1):
		s[i] = s[i - 1] - a[k - 2 * i + 1] - a[k - 2 * i + 2]
	res = s[0]
	for i in range(k):
		for j in range(1, z + 1):
			if k - i < 2 * j:
				break
			cur = s[j] + (a[i] + a[i + 1]) * j
			res = max(cur, res)
	print(res)


import sys
input = sys.stdin.buffer.readline
T = int(input())
for _ in range(T):
	(n, k, z) = map(int, input().split())
	ls = list(map(int, input().split()))
	(sm, mxpr, mx) = (ls[0], 0, 0)
	for i in range(1, 1 + k):
		sm += ls[i]
		mxpr = max(mxpr, ls[i - 1] + ls[i])
		if (k - i) % 2:
			if z > 0 and i + (z - 1) * 2 + 1 >= k:
				lsm = sm + ls[i - 1] + (k - i) // 2 * mxpr
				mx = max(mx, lsm)
		elif i + z * 2 >= k:
			lsm = sm + (k - i) // 2 * mxpr
			mx = max(mx, lsm)
	print(mx)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	f = list(map(int, input().split()))
	g = []
	for i in range(k):
		g.append(f[i] + f[i + 1])
	res = sum(f[:k + 1])
	for i in range(1, z + 1):
		index = k + 1 - 2 * i
		if index < 0:
			break
		tmp = sum(f[:index])
		lm = max(g[:index]) if index > 0 else 0
		res = max(res, tmp + lm * i)
	print(res)


t = int(input())
for ii in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	rightStop = []
	leftStop = [0]
	s = sum(a[:k + 1])
	rightStop.append(s)
	init = 1
	while init <= z:
		tempMoves = k - 2 * init + 2
		if k - 2 * init >= 0:
			leftStop.append(sum(a[:tempMoves]) + a[tempMoves - 2] * init + a[tempMoves - 1] * (init - 1))
		else:
			break
		init += 1
	init = 1
	while init <= z:
		if k - 2 * init >= 0:
			maxIndex = k - 2 * init
			best = 0
			for i in range(maxIndex):
				best = max(best, a[i] + a[i + 1])
			rightStop.append(sum(a[:maxIndex + 1]) + best * init)
			init += 1
		else:
			break
	print(max(max(leftStop), max(rightStop)))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	mx = 0
	s = 0
	ans = 0
	for i in range(k + 1):
		if i < n - 1:
			mx = max(mx, arr[i] + arr[i + 1])
		s += arr[i]
		if i & 1 == k & 1:
			temp = (k - i) // 2
			if temp <= z:
				ans = max(ans, s + temp * mx)
	print(ans)


for i in ' ' * int(input()):
	(n, k, z) = map(int, input().split())
	L = list(map(int, input().split()))
	mx = sum(L[:k + 1])
	sumL = []
	for j in range(n - 1):
		sumL.append(L[j] + L[j + 1])
	for j in range(z):
		if k <= 2 * j + 1:
			break
		count = max(sumL[:k - 2 * j - 1]) * (j + 1) + sum(L[:k + 1 - 2 * (j + 1)])
		if count > mx:
			mx = count
	print(mx)


t = int(input())
while t:
	(n, k, z) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	k_sum = sum(a[0:k + 1])
	pre = [a[0]]
	for i in range(1, k + 1):
		pre.append(pre[-1] + a[i])
	maxi = a[0]
	curr = a[0]
	for i in range(1, k + 1):
		left = k - i
		curr += a[i]
		if left >= 2 * z:
			temp = curr + a[i - 1] * z + a[i] * z
			left = left - 2 * z
			temp += pre[left + i] - pre[i]
			maxi = max(temp, maxi)
		else:
			temp = curr + a[i - 1] * (left // 2 + left % 2) + a[i] * (left // 2)
			maxi = max(temp, maxi)
		maxi = max(curr, maxi)
	print(maxi)
	t -= 1


import sys
import math
from functools import reduce
import bisect

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return False
for _ in range(int(input())):
	(n, k, z) = getNM()
	arr = getList()
	arr = arr[:k + 1]
	prefix = [arr[0]]
	for i in range(1, len(arr)):
		prefix.append(prefix[i - 1] + arr[i])
	s = sum(arr)
	t = arr[0]
	ans = s
	for i in range(1, n):
		steps = k - i
		t = prefix[i]
		if not steps:
			break
		if steps & 1 and steps < z * 2:
			t += arr[i - 1] * (steps // 2 + 1) + arr[i] * (steps // 2)
		else:
			t += (arr[i - 1] + arr[i]) * min(z, steps // 2)
		steps -= z * 2
		if steps > 0:
			t += prefix[i + steps] - prefix[i]
		ans = max(ans, t)
	print(ans)


rw = int(input())
for qwe in range(rw):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	p = []
	pref = []
	q = 0
	for i in range(n):
		q += a[i]
		pref.append(q)
	for i in range(1, n):
		if k < i:
			break
		if k == i:
			p.append(pref[i])
			break
		if k - i - z * 2 > 0:
			p.append(pref[i] + (a[i - 1] + a[i]) * z)
			p[i - 1] += pref[k - z * 2] - pref[i]
		else:
			p.append(pref[i] + (a[i - 1] + a[i]) * ((k - i) // 2))
			if (k - i) % 2 == 1:
				p[i - 1] += max(a[i - 1], a[i + 1])
	print(max(p))


import sys

def solve(A, k, z):
	DEBUG = False
	n = len(A)
	cum = [0] * n
	cum[0] = A[0]
	for i in range(1, n):
		cum[i] = cum[i - 1] + A[i]
	if DEBUG:
		print('CUM:', cum)
	BEST_TWO_LEFT = [0] * (k + 1)
	for i in range(1, min(k, n - 2)):
		TWO = A[i - 1] + A[i]
		BEST_TWO_LEFT[i] = BEST_TWO_LEFT[i - 1] if TWO <= BEST_TWO_LEFT[i - 1] else TWO
	if DEBUG:
		print('BEST_TWO_LEFT', BEST_TWO_LEFT)
	BEST_Z_JUST_TWOS = [0] * (z + 1)
	BEST_Z_ONE = [0] * (z + 1)
	BEST_STRAIGHT = cum[k]
	OPTIONS = [BEST_STRAIGHT]
	for zi in range(1, z + 1):
		missed = 2 * zi
		if k - missed >= 0:
			TOT_REMOVE = cum[k] - cum[k - missed]
			TOT_ADD = zi * BEST_TWO_LEFT[k - missed]
			OPTIONS.append(cum[k - missed] + max(TOT_ADD, 0))
			if DEBUG:
				print('  ', missed, cum[k - missed], TOT_REMOVE, TOT_ADD, OPTIONS[-1])
		missed = 2 * (zi - 1) + 1
		if k - missed >= 1:
			TOT_REMOVE = cum[k] - cum[k - missed]
			TOT_ADD = (zi - 1) * BEST_TWO_LEFT[k - missed] + A[k - missed - 1]
			OPTIONS.append(cum[k - missed] + max(TOT_ADD, 0))
			if DEBUG:
				print('  ', missed, cum[k - missed], TOT_REMOVE, TOT_ADD, OPTIONS[-1])
	if DEBUG:
		print('Options:', OPTIONS)
	return max(OPTIONS)
IN = [x.strip() for x in sys.stdin.readlines()]
T = int(IN[0])
cur = 1
for ti in range(T):
	(n, k, z) = [int(x) for x in IN[cur].split(' ')]
	A = [int(x) for x in IN[cur + 1].split(' ')]
	res = solve(A, k, z)
	print(res)
	cur += 2


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	mini = sum(a[:k + 1])
	acum = [a[0]]
	for i in range(1, k + 1):
		acum.append(acum[i - 1] + a[i])
	j = 1
	while k:
		ans = acum[j]
		k -= 1
		i = j
		ki = k
		zi = z
		while i and zi and ki:
			ans += a[i - 1]
			zi -= 1
			ki -= 1
			if ki:
				ans += a[i]
				ki -= 1
		i += 1
		if ki:
			ans += acum[i + ki - 1] - acum[i - 1]
		mini = max(mini, ans)
		j += 1
	print(mini)


t = int(input())
for x in range(t):
	info = input().split()
	(n, k, z) = (int(info[0]), int(info[1]), int(info[2]))
	array = [int(num) for num in input().split()]
	count = 0
	total = 0
	maxpair = 0
	for i in range(k + 1):
		if i < n - 1:
			maxpair = max(maxpair, array[i] + array[i + 1])
		total += array[i]
		if i % 2 == k % 2:
			num = (k - i) // 2
			if num <= z:
				count = max(count, total + maxpair * num)
	print(count)


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange
sys.setrecursionlimit(3 * 10 ** 6)

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def ri():
	return int(f.readline().strip())

def ria():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def rs():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from collections import deque
import math
NUMBER = 10 ** 9 + 7

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m

def choose(n, k):
	if n < k:
		assert false
	return mult(factorial(n), modinv(mult(factorial(k), factorial(n - k)))) % NUMBER
from collections import deque, defaultdict
import heapq
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def dfs(g, timeIn, timeOut, depths, parents):
	cnt = 0
	stack = [[1, 0, 0, 0]]
	while stack:
		(v, neig_i, parent, depth) = stack[-1]
		parents[v] = parent
		depths[v] = depth
		if neig_i == 0:
			timeIn[v] = cnt
			cnt += 1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i += 1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u, 0, v, depth + 1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1
cnt = 0

@bootstrap
def dfs(v, adj, timeIn, timeOut, depths, parents, parent=0, depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt += 1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u, adj, timeIn, timeOut, depths, parents, v, depth + 1)
	timeOut[v] = cnt
	cnt += 1
	yield

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def get_num_2_5(n):
	twos = 0
	fives = 0
	while n > 0 and n % 2 == 0:
		n //= 2
		twos += 1
	while n > 0 and n % 5 == 0:
		n //= 5
		fives += 1
	return (twos, fives)

def shift(a, i, num):
	for _ in range(num):
		(a[i], a[i + 1], a[i + 2]) = (a[i + 2], a[i], a[i + 1])

def equal(x, y):
	return abs(x - y) <= 1e-09

def getAngle(a, b, c):
	ang = math.degrees(math.atan2(c[1] - b[1], c[0] - b[0]) - math.atan2(a[1] - b[1], a[0] - b[0]))
	return ang + 360 if ang < 0 else ang

def getLength(a, b):
	return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
from heapq import heapify, heappush, heappop

def bfs(adj):
	s = set()
	d = defaultdict(set)
	q = deque([])
	s.add(0)
	d[0].add(0)
	q.append((0, 0))
	while len(q) > 0:
		(v, depth) = q.popleft()
		for u in adj[v]:
			if u not in s:
				s.add(u)
				d[depth + 1].add(u)
				q.append((u, depth + 1))
	return d

def isSubsetSum(arr, n, summ):
	subarr = [[False for i in range(summ + 1)] for i in range(n + 1)]
	for i in range(n + 1):
		subarr[i][0] = True
	for i in range(1, summ + 1):
		subarr[0][i] = False
	for i in range(1, n + 1):
		for j in range(1, summ + 1):
			if j < arr[i - 1]:
				subarr[i][j] = subarr[i - 1][j]
			if j >= arr[i - 1]:
				subarr[i][j] = subarr[i - 1][j] or subarr[i - 1][j - arr[i - 1]]
	return subarr[n][summ]

def bfs(v, adj, onpath):
	s = set()
	d = defaultdict(set)
	q = deque([])
	s.add(0)
	d[0].add(0)
	q.append((0, 0))
	while len(q) > 0:
		(v, depth) = q.popleft()
		for u in adj[v]:
			if u not in s:
				s.add(u)
				d[depth + 1].add(u)
				q.append((u, depth + 1))
	return d

@bootstrap
def dfs(v, p, adj, b, path):
	if v == b:
		path.append(b)
		yield True
	for u in adj[v]:
		if u == p:
			continue
		on = (yield dfs(u, v, adj, b, path))
		if on:
			path.append(v)
			yield True
	yield False

@bootstrap
def dfs1(v, p, adj, d, mcd, onpath, c, root):
	if len(mcd) < d + 1:
		mcd.append([c[v], d, root, v])
	if mcd[d][0] > c[v]:
		mcd[d][0] = c[v]
		mcd[d][3] = v
	for u in adj[v]:
		if u == p or onpath[u]:
			continue
		yield dfs1(u, v, adj, d + 1, mcd, onpath, c, root)
	yield False

def solution(a, n, k, z):
	z = min(z, k // 2)
	pos_end = []
	for i in range(z, -1, -1):
		if k - 2 * i >= 0:
			pos_end.append(k - 2 * i)
	min_pos = pos_end[0]
	best_couple = (a[0], a[1])
	for i in range(1, min(min_pos + 1, len(a) - 1)):
		if a[i] + a[i + 1] > sum(best_couple):
			best_couple = (a[i], a[i + 1])
	pre_sum = sum(a[:min_pos + 1])
	max_opt = pre_sum + z * sum(best_couple)
	cur_sum = pre_sum
	for j in range(1, len(pos_end)):
		pos = pos_end[j]
		cur_sum += a[pos - 1] + a[pos]
		if a[pos - 2] + a[pos - 1] > sum(best_couple):
			best_couple = (a[pos - 2], a[pos - 1])
		if a[pos - 1] + a[pos] > sum(best_couple):
			best_couple = (a[pos - 1], a[pos])
		if pos + 1 < len(a):
			if a[pos] + a[pos + 1] > sum(best_couple):
				best_couple = (a[pos], a[pos + 1])
		max_opt = max(max_opt, cur_sum + (z - j) * sum(best_couple))
	return max_opt

def main():
	T = 1
	T = ri()
	for i in range(T):
		(n, k, z) = ria()
		a = ria()
		x = solution(a, n, k, z)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = [int(x) for x in input().split()]
	ans = 0
	s = 0
	mx = 0
	for t in range(z + 1):
		pos = k - 2 * t
		if pos < 0:
			continue
		mx = 0
		s = 0
		for i in range(pos + 1):
			if i < n - 1:
				mx = max(mx, a[i] + a[i + 1])
			s += a[i]
		ans = max(ans, s + mx * t)
	print(ans)


for case in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	summ = [0] * n
	adj = [0] * n
	for i in range(n):
		summ[i] = summ[i - 1] + arr[i]
		if i >= 1:
			adj[i] = max(adj[i - 1], arr[i] + arr[i - 1])
	z = min(z, k // 2)
	ans = summ[k] - arr[0]
	count = 0
	for i in range(k - 1, 0, -1):
		if (k - i) % 2 == 0:
			count += 1
			if count <= z:
				ans = max(ans, summ[i] - arr[0] + count * adj[i])
			else:
				break
		elif count + 1 <= z:
			ans = max(ans, summ[i] - arr[0] + arr[i - 1] + count * adj[i])
		else:
			break
	print(ans + arr[0])


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	nei = list((a1 + a2 for (a1, a2) in zip(a, a[1:])))
	best = 0
	for lefts in range(z + 1):
		rights = k - lefts
		for final_left in [False, True]:
			if rights < 1 + lefts - final_left:
				continue
			total = sum(a[:rights - lefts + final_left + 1])
			if final_left:
				total += a[rights - lefts]
			total += (lefts - final_left) * max(nei[:rights - lefts + final_left])
			best = max(best, total)
	print(best)


t = int(input())
for i in range(t):
	(n, k, z) = map(int, list(input().split()))
	a = list(map(int, list(input().split())))
	l = 0
	for j in range(min(z + 1, k // 2 + 1)):
		x = sum(a[:k - 2 * j + 1])
		d = 0
		for m in range(k - 2 * j + 1):
			c = sum(a[m:m + 2])
			if c > d:
				d = c
		y = x + j * d
		if y > l:
			l = y
	print(l)


t = int(input())
for p in range(t):
	(n, k, z) = map(int, input().split())
	mas = list(map(int, input().split()))
	prev = [0]
	ost = k
	summ = mas[0]
	maxi = 0
	for i in range(n):
		prev.append(prev[-1] + mas[i])
	for i in range(1, k + 1):
		ost -= 1
		ost1 = ost
		z1 = min(z, ost // 2 + ost % 2)
		summ += mas[i]
		summ1 = summ
		if maxi < summ + prev[i + ost + 1] - prev[i + 1]:
			maxi = summ + prev[i + ost + 1] - prev[i + 1]
		if ost == 0:
			break
		for j in range(z1):
			if ost == 0:
				break
			if ost == 1:
				if mas[i + 1] > mas[i - 1]:
					summ += mas[i + 1]
				else:
					summ += mas[i - 1]
				ost -= 1
			else:
				ost -= 2
				summ += mas[i] + mas[i - 1]
			if maxi < summ + prev[i + ost + 1] - prev[i + 1]:
				maxi = summ + prev[i + ost + 1] - prev[i + 1]
		summ = summ1
		ost = ost1
	print(maxi)


from math import *
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	pre = []
	pre.append(a[0])
	for i in range(1, n):
		pre.append(pre[-1] + a[i])
	ans = 0
	for i in range(1, n):
		if i > k:
			ans = max(ans, pre[k])
			continue
		rem = k - i
		now = 0
		if z * 2 <= rem:
			now = (a[i - 1] + a[i]) * z
			rem = rem - z * 2
			now += pre[min(i + rem, n - 1)]
		else:
			now = (a[i - 1] + a[i]) * (rem // 2)
			rem = rem - rem // 2 * 2
			if rem == 1:
				now += a[i - 1]
			now += pre[min(i, n - 1)]
		ans = max(ans, now)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	ar = list(map(int, input().split()))
	ans = 0
	pre = [ar[0]]
	mx = [ar[0] + ar[1]]
	for i in range(1, len(ar)):
		pre.append(pre[i - 1] + ar[i])
	for i in range(1, len(ar) - 1):
		mx.append(max(mx[i - 1], ar[i] + ar[i + 1]))
	mx.append(0)
	for i in range(z + 1):
		index = k - 2 * i
		if index < 0:
			break
		ans = max(ans, i * mx[index] + pre[index])
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = [int(j) for j in input().split()]
	s = l[0]
	p = [0] * (n + 1)
	p[0] = 0
	total = 0
	for i in range(n):
		p[i + 1] = p[i] + l[i]
	for i in range(n - 1):
		t = p[i + 1]
		c = k - i
		temp = z
		ch = 1
		if c < 0:
			break
		while c and temp:
			if ch:
				t += l[i + 1]
				ch ^= 1
			else:
				t += l[i]
				temp -= 1
				ch ^= 1
			c -= 1
		if not c:
			total = max(total, t)
			continue
		t += p[i + c + 1] - p[i + 1]
		total = max(total, t)
	print(total)


from sys import stdin

def readline():
	return stdin.readline()
tests = int(readline())

def solve(n, k, z, a):
	p = [0]
	for v in a:
		p.append(v + p[-1])
	s = a[0]
	res = a[0]
	for i in range(1, min(n, k + 1)):
		s += a[i]
		r = (k - i) // 2
		loop = min(z, r)
		cur = s + loop * (a[i] + a[i - 1])
		if z - loop > 0 and k - i - loop * 2 > 0:
			cur += a[i - 1]
		else:
			rem = k - i - loop * 2
			last = min(i + rem + 1, n)
			cur += p[last] - p[i + 1]
		res = max(res, cur)
	return res
for t in range(0, tests):
	(n, k, z) = list(map(int, readline().split(' ')))
	a = list(map(int, readline().split(' ')))
	print(solve(n, k, z, a))


import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def inc(d, c):
	d[c] = d[c] + 1 if c in d else 1

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)

def bo(i):
	return ord(i) - ord('a')

def ck(x, y):
	return int(bin(x)[2:] + bin(y)[2:], 2)
t = fi()
while t > 0:
	t -= 1
	(n, k, z) = mi()
	a = li()
	max_pair = [0 for i in range(n + 1)]
	pre = [0 for i in range(n)]
	for i in range(n):
		if i > 0:
			max_pair[i] = max(max_pair[i - 1], a[i] + a[i - 1])
		pre[i] = pre[i - 1] + a[i]
	maxi = pre[k]
	for i in range(1, z + 1):
		maxi = max(maxi, pre[max(0, k - i * 2)] + i * max_pair[max(0, k - i * 2 + 1)])
	print(maxi)


from sys import stdin, setrecursionlimit as srl
from threading import stack_size, Thread
srl(int(1000000000.0) + 7)
stack_size(int(100000000.0))

def solve():
	t = int(input())
	for _ in range(t):
		a = [0]
		(n, k, z) = map(int, input().split())
		x = input().split()
		for i in x:
			a.append(int(i))
		Ma = float('-inf')
		M = [Ma, Ma]
		for i in range(2, k + 2):
			Ma = max(Ma, a[i] + a[i - 1])
			M.append(Ma)
		pre = [0, a[1]]
		for i in range(2, k + 2):
			pre.append(pre[-1] + a[i])
		Ma = float('-inf')
		for i in range(max(1, k + 1 - 2 * z), k + 2):
			if (k + 1 - i) % 2:
				poss = pre[i] + a[i - 1] + (k - i) * M[i] // 2
				Ma = max(Ma, poss)
			else:
				poss = pre[i] + (k - i + 1) * M[i] // 2
				Ma = max(Ma, poss)
		print(Ma)
Thread(target=solve).start()


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	lmax = 0
	ans = 0
	s = 0
	for t in range(z + 1):
		pos = k - 2 * t
		if pos < 0:
			break
		s = 0
		lmax = 0
		for i in range(pos + 1):
			if i < n - 1:
				lmax = max(lmax, arr[i] + arr[i + 1])
			s += arr[i]
		ans = max(ans, s + lmax * t)
	print(ans)


import sys, math as mt
import heapq as hp
import math as mt
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n, k, x) = I()
	l = I()
	if x == 0:
		print(sum(l[:k + 1]))
	else:
		temp = l[:k + 1]
		ans = sum(temp)
		d = max(temp)
		su = 0
		used = 0
		pre = temp.copy()
		for i in range(1, k):
			pre[i] += pre[i - 1]
		for i in range(k):
			if i - 1 >= 0:
				su = pre[i]
				if x + (x - 1) + i <= k:
					le = x
				else:
					still = k - i
					le = min(x, mt.ceil(still / 2))
				su += le * temp[i - 1]
				su += (le - 1) * temp[i]
				used = i + le + (le - 1)
				touse = k - used
				su += pre[i - 1 + touse] - pre[i - 1]
				ans = max(ans, su)
		print(ans)


import sys
input = sys.stdin.readline
from collections import *
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	acc = [0]
	for ai in a:
		acc.append(acc[-1] + ai)
	ans = 0
	for lc in range(z + 1):
		rc = k - lc
		if rc < lc:
			continue
		for i in range(lc + 1):
			cand = acc[rc - i + 1]
			for j in range(lc - i):
				cand += a[rc - i - 1 - j]
			l = []
			for j in range(1, rc - i + 1):
				l.append(a[j] + a[j - 1])
			if len(l) > 0:
				cand += max(l) * i
			ans = max(ans, cand)
	print(ans)


from math import ceil, floor
for _ in range(int(input())):
	(n, k, x) = [int(i) for i in input().split()]
	lst = [int(i) for i in input().split()]
	(s, su) = (list(), 0)
	for i in range(k + 1):
		s.append(su + lst[i])
		su += lst[i]
	result = s[k]
	for i in range(1, k + 1):
		f = min(k - i, 2 * x)
		safe = s[i] + ceil(f / 2) * lst[i - 1] + floor(f / 2) * lst[i]
		if k - i != f:
			safe += s[k - 2 * x] - s[i]
		if safe > result:
			result = safe
	print(result)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	total = 0
	sum = 0
	r = k
	res = []
	rem = k - z * 2
	if rem <= 0:
		l = 0
	else:
		l = rem + 1
	for i in range(l):
		total += arr[i]
	for i in range(k):
		sum += arr[i]
		if r - z * 2 <= 0:
			r -= 1
			if r % 2 == 0:
				res.append(arr[i + 1] + sum + r // 2 * (arr[i] + arr[i + 1]))
			else:
				a = (r - 1) // 2
				res.append(arr[i + 1] + sum + a * (arr[i] + arr[i + 1]) + arr[i])
		else:
			res.append(sum + z * (arr[i] + arr[i + 1]) + (total - sum))
			r -= 1
	print(max(res))


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	pre = [0] * n
	pre[0] = arr[0]
	for i in range(1, n):
		pre[i] = pre[i - 1] + arr[i]
	ans = 0
	for i in range(1, k + 1):
		mv = min(z, (k - i + 1) // 2)
		temp = pre[k - 2 * mv] + (arr[i] + arr[i - 1]) * mv
		ans = max(temp, ans)
	print(ans)


import sys
input = sys.stdin.readline
for nt in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	a = a[0:k + 1]
	n = len(a)
	pref = [a[0]]
	for i in range(1, n):
		pref.append(pref[-1] + a[i])
	maxx = [a[0]]
	left = [k]
	start = [0]
	for i in range(1, n):
		m = z
		t = k - i
		s = pref[i]
		curr = i
		while m and t:
			if curr == i:
				curr -= 1
				m -= 1
				t -= 1
				s += a[curr]
			else:
				curr += 1
				t -= 1
				s += a[curr]
		maxx.append(s)
		left.append(t)
		start.append(curr)
	ans = 0
	for i in range(n):
		ans = max(ans, maxx[i] + (pref[start[i] + left[i]] - pref[start[i]]))
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = [int(x) for x in input().split()]
	(suma, mx) = (0, 0)
	odp = 0
	for t in range(z + 1):
		pos = k - 2 * t
		if pos < 0:
			continue
		(suma, mx) = (0, 0)
		for i in range(pos + 1):
			if i < n - 1:
				mx = max(mx, a[i] + a[i + 1])
			suma += a[i]
		odp = max(odp, mx * t + suma)
	print(odp)


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
cases = int(input())
for t in range(cases):
	(n, k, z) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = [0] * (n + 1)
	for i in range(n):
		b[i + 1] = b[i] + a[i]
	s = 0
	for i in range(1, k + 1):
		s1 = b[i + 1]
		left = k - i
		if left / 2 > z:
			s1 += z * a[i - 1] + z * a[i] + b[i + 1 + left - 2 * z] - b[i + 1]
		else:
			s1 += left // 2 * a[i] + (left - left // 2) * a[i - 1]
		s = max(s1, s)
	print(s)


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	(n, k, z) = mp()
	l = li()
	ans = float('-inf')
	pre = [0]
	for i in range(n):
		pre.append(pre[-1] + l[i])
	for i in range(1, k + 1):
		rem = k - i
		s = pre[i]
		left = min(2 * z, rem)
		s += (l[i] + l[i - 1]) * (left // 2) + l[i - 1] * (left % 2)
		again = rem - left
		s += pre[i + again + 1] - pre[i]
		ans = max(ans, s)
	print(ans)
for _ in range(inp()):
	solve()


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	A = [int(x) for x in input().split()]
	res = [0] * n
	res[0] = A[0]
	for i in range(1, n):
		res[i] = res[i - 1] + A[i]
	mx = -1
	for i in range(1, k + 1):
		mv = min(z, (k - i + 1) // 2)
		su = (A[i] + A[i - 1]) * mv + res[k - 2 * mv]
		mx = max(mx, su)
	print(mx)


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	sumarray = [l[0]]
	sum = l[0]
	for j in range(1, n):
		sum += l[j]
		sumarray.append(sum)
	maxx = 0
	for j in range(1, n):
		req = j
		if req > k:
			break
		rem = k - req
		x = l[j - 1] + l[j]
		total = min(rem, 2 * z)
		score = x * (total // 2) + total % 2 * l[j - 1]
		score += sumarray[j]
		rem -= total
		if rem > 0:
			score += sumarray[j + rem] - sumarray[j]
		maxx = max(maxx, score)
	print(maxx)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	s = [0]
	for x in a:
		s += (x + s[-1],)
	ans = 0
	i = 0
	ans = 0
	while i < k:
		sum = s[i + 1] - s[0]
		mv = k - i
		hf = mv // 2
		l = min(z, hf)
		sum += l * (a[i] + a[i + 1])
		mv -= 2 * l
		if mv:
			sum += s[i + 1 + mv] - s[i + 1]
		ans = max(sum, ans)
		i += 1
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	lis = list(map(int, input().split()))
	lis = lis[:k + 1][::-1]
	pre = [0] * (k + 5)
	pre[0] = lis[0]
	for i in range(k, -1, -1):
		pre[i] = pre[i + 1] + lis[i]
	tmp = ans = pre[0]
	for i in range(1, k):
		ss = lis[i] + lis[i + 1]
		g = min(i // 2, z)
		tmp = pre[i] + ss * g
		if i // 2 > g:
			a = i - 2 * g
			tmp += pre[i - a] - pre[i]
		elif i % 2:
			if g == z:
				tmp += lis[i - 1]
			else:
				tmp += max(lis[i - 1], lis[i + 1])
		if tmp > ans:
			ans = tmp
	print(ans)


for x in range(int(input())):
	(n, k, z) = map(int, input().split())
	s = list(map(int, input().split()))
	pref = [0 for _ in range(n + 1)]
	for i in range(len(s)):
		pref[i + 1] = pref[i] + s[i]
	maxx = s[0]
	for i in range(1, k + 1):
		now = pref[i + 1]
		if k - i < 2 * z:
			if (k - i) % 2 == 1:
				now += s[i - 1] * ((k - i + 1) // 2) + s[i] * ((k - i) // 2)
			else:
				now += s[i - 1] * (k - i) // 2 + s[i] * (k - i) // 2
		else:
			now += s[i - 1] * z + s[i] * z
			now += pref[i + 1 + k - i - 2 * z] - pref[i + 1]
		if now > maxx:
			maxx = now
	print(maxx)


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default='z', func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	pref = [0] * (n + 1)
	ans = 0
	for i in range(1, k + 1):
		ans += l[i]
		if i == 1:
			pref[i] = l[i]
		else:
			pref[i] = pref[i - 1] + l[i]
	for i in range(n - 1):
		l1 = k - i
		e = min(l1 // 2, z)
		ans1 = pref[i] + e * (l[i] + l[i + 1])
		l1 = l1 - 2 * e
		if l1 > 0:
			ans1 += pref[i + l1] - pref[i]
		ans = max(ans, ans1)
	print(ans + l[0])


from sys import *
input = stdin.readline
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	mx = 0
	d = [0]
	for i in range(1, n):
		mx = max(mx, a[i] + a[i - 1])
		d.append(mx)
	p = []
	sn = 0
	for i in range(n):
		sn += a[i]
		p.append(sn)
	ans = p[k]
	for i in range(z):
		t = k - 2 * i - 1
		if t <= 0:
			break
		r = p[t] + a[t] * i + a[t - 1] * (i + 1)
		ans = max(ans, p[t - 1] + (i + 1) * d[t - 1], r)
	stdout.write(str(ans) + '\n')


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	l1 = []
	c = 0
	for j in l:
		c += j
		l1.append(c)
	ans = l1[k]
	l2 = []
	for j in range(n - 1):
		l2.append(l[j] + l[j + 1])
	for j in range(z + 1):
		if k - 2 * j >= 0 and j <= n:
			if k > 2 * j:
				x = max(l2[:k - 2 * j])
			else:
				x = l2[0]
			if j:
				y = max(l2[:k - 2 * (j - 1)])
			ans = max(ans, l1[k - 2 * j] + j * x)
			if k >= 2 * (j - 1) + 2 and j > 0:
				ans = max(ans, l1[k - 2 * (j - 1) - 1] + (j - 1) * y + l[k - 2 * (j - 1) - 2])
	print(ans)


t = int(input())
for _ in range(t):
	(n, k, z) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	best = -1
	best_pair = -1
	acc = a[0]
	used = 1
	for (prev, cur) in zip(a[:-1], a[1:]):
		used += 1
		if prev + cur > best_pair:
			best_pair = prev + cur
		acc += cur
		if (k - used + 2) // 2 <= z and used <= k + 1:
			score = acc + (k + 1 - used) // 2 * best_pair + (k + 1 - used) % 2 * prev
			if score > best:
				best = score
	print(best)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	pre = [0] * n
	pre[0] = a[0]
	for i in range(1, n):
		pre[i] = a[i] + pre[i - 1]
	mx = -1
	for i in range(1, k + 1):
		mv = min(z, (k - i + 1) // 2)
		su = mv * (a[i] + a[i - 1]) + pre[k - 2 * mv]
		mx = max(mx, su)
	print(mx)


T = int(input())
for t in range(T):
	(n, k, z) = map(int, input().split())
	arr = [int(x) for x in input().split()]
	answer = arr[0]
	for take in range(z + 1):
		sum = 0
		for i in range(k - 2 * take + 1):
			sum += arr[i]
		for i in range(min(k - 2 * take + 1, n - 1)):
			answer = max(answer, sum + take * (arr[i] + arr[i + 1]))
	print(answer)


import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	pos = -1
	ans = 0
	msum = 0
	sumsf = 0
	movesf = 0
	pref = [0] * (n + 1)
	for i in range(1, k + 1):
		ans += l[i]
		if i:
			pref[i] = pref[i - 1] + l[i]
		else:
			pref[i] = l[i]
	for i in range(n - 1):
		left = k - i
		poss = min(left >> 1, z)
		cur = pref[i] + poss * (l[i] + l[i + 1])
		left = max(0, left - 2 * poss)
		cur += pref[i + left] - pref[i]
		ans = max(ans, cur)
	print(ans + l[0])


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s)
	sys.stdout.write('\n')

def wi(n):
	sys.stdout.write(str(n))
	sys.stdout.write('\n')

def wia(a, sep=' '):
	sys.stdout.write(sep.join([str(x) for x in a]))
	sys.stdout.write('\n')

def solve(n, K, z, a):
	dp = [[[0] * 2 for j in range(z + 1)] for i in range(n)]
	dp[0][0][0] = a[0]
	for j in range(z + 1):
		for i in range(n):
			for k in range(2):
				if i < n - 1:
					dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][k] + a[i + 1])
				if i > 0 and j < z and (k == 0):
					dp[i - 1][j + 1][1] = max(dp[i - 1][j + 1][1], dp[i][j][0] + a[i - 1])
	ans = 0
	for j in range(z + 1):
		i = K - 2 * j
		if i < 0:
			continue
		ans = max(ans, dp[i][j][0], dp[i][j][1])
	return ans

def main():
	for _ in range(ri()):
		(n, k, z) = ria()
		a = ria()
		wi(solve(n, k, z, a))
main()


for testcases in range(int(input())):
	(n, j, l) = map(int, input().split())
	num = list(map(int, input().split()))
	sumf = []
	for i in range(l + 1):
		maxi = 0
		summ = 0
		for x in range(j + 1 - 2 * i):
			summ += num[x]
			if x + 1 < n:
				maxi = max(maxi, num[x] + num[x + 1])
		summ = summ + i * maxi
		sumf.append(summ)
	print(max(sumf))


import sys
input = sys.stdin.readline
aaaa = list()
for kek in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	left = list()
	for i in range(1, n):
		left.append((a[i] + a[i - 1], i))
	left.sort(key=lambda x: (-x[0], x[1]))
	answer = 0
	for x in range(z + 1):
		ans1 = 0
		for i in range(k - 2 * x + 1):
			ans1 += a[i]
		ans2 = ans1 - a[k - 2 * x]
		y = x
		for i in range(len(left)):
			if y == 0:
				break
			if left[i][1] <= k - 2 * x + 1:
				ans1 += x * left[i][0]
				y = 0
		if y == 0:
			answer = max(answer, ans1)
		y = x - 1
		for i in range(len(left)):
			if y <= 0:
				break
			if left[i][1] <= k - 2 * x + 1:
				ans2 += (x - 1) * left[i][0]
				y = 0
		ans2 += a[k - 2 * x]
		if y == 0:
			answer = max(answer, ans2)
	aaaa.append(answer)
print(*aaaa, sep='\n')


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for t in range(z + 1):
		tec = k - t * 2
		mx = 0
		sm = 0
		for i in range(tec + 1):
			sm += a[i]
			if i + 1 != n:
				mx = max(mx, a[i] + a[i + 1])
		sm += mx * t
		ans = max(ans, sm)
	print(ans)


t = int(input())
for test in range(t):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	dp = [[[0, 0] for i in range(z + 1)] for j in range(n)]
	dp[0][0][0] = arr[0]
	m = 0
	for j in range(z + 1):
		for i in range(n):
			if i > 0:
				dp[i][j] = [arr[i] + dp[i - 1][j][0], dp[i - 1][j][1] + 1]
			if i < n - 1 and j > 0 and (dp[i][j - 1][0] + arr[i + 1] + arr[i] > dp[i][j][0]):
				dp[i][j] = [dp[i][j - 1][0] + arr[i + 1] + arr[i], dp[i + 1][j - 1][1] + 1]
			if dp[i][j][1] == k:
				m = max(m, dp[i][j][0])
	print(m)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	lis = list(map(int, input().split()))
	sul = []
	su = 0
	for i in lis:
		su += i
		sul.append(su)
	ma = 0
	for i in range(1, k + 1):
		tu = k - i
		lu = z
		su = sul[i]
		if tu >= 2 * z:
			su += z * lis[i] + z * lis[i - 1]
			tu -= 2 * z
			su += sul[i + tu] - sul[i]
		elif tu % 2 == 0:
			m = min(tu // 2, z)
			su += m * lis[i]
			su += m * lis[i - 1]
		else:
			m = min(tu // 2, z)
			su += m * lis[i]
			su += (m + 1) * lis[i - 1]
		if su > ma:
			ma = su
	print(ma)


import sys
for _ in range(int(sys.stdin.readline())):
	(n, k, z) = map(int, sys.stdin.readline().split())
	a = [int(i) for i in sys.stdin.readline().split()]
	prefix_sums = [a[0]]
	for a_i in a[1:]:
		prefix_sums.append(prefix_sums[-1] + a_i)
	if z == 0:
		print(sum(a[:k + 1]))
	else:
		max_score = a[0]
		for ind in range(1, n):
			if k == 0:
				break
			local_max_score = prefix_sums[ind]
			local_k = k - 1
			local_z = z
			flag = 0
			while local_k != 0 and local_z != 0:
				if flag == 0:
					local_max_score += a[ind - 1]
					flag = 1
					local_z -= 1
				else:
					local_max_score += a[ind]
					flag = 0
				local_k -= 1
			if local_k == local_z == 0:
				max_score = max(max_score, local_max_score)
			elif local_k == 0:
				max_score = max(max_score, local_max_score)
			elif local_z == 0:
				local_max_score += prefix_sums[ind - 1 + local_k] - prefix_sums[ind - 1]
				max_score = max(max_score, local_max_score)
			k -= 1
		print(max_score)


import sys
import math
from decimal import *

def I():
	return int(sys.stdin.readline())

def IL():
	return list(map(int, sys.stdin.readline().strip().split()))

def ILS():
	return list(map(str, sys.stdin.readline().strip().split()))

def solve():
	tt = I()
	for ii in range(tt):
		(n, k, z) = IL()
		a = IL()
		ss = [a[0]] * n
		for i in range(1, n):
			ss[i] = ss[i - 1] + a[i]
		ans = a[0]
		mx = a[0] + a[1]
		idx = 0
		i = 1
		while i <= k and i < n:
			ans += a[i]
			i += 1
		for i in range(1, k + 1):
			temp = ss[i]
			cur = a[i] + a[i - 1]
			rem = k - i
			if rem < 2 * z:
				temp += rem // 2 * cur
				if rem % 2 == 1:
					temp += a[i - 1]
				if rem % 2 == 1 and i + 1 < n and (a[i + 1] > a[i - 1]):
					temp += a[i + 1] - a[i - 1]
			else:
				rem -= 2 * z
				temp += z * cur
				temp += ss[i + rem] - ss[i]
			ans = max(ans, temp)
		print(ans)
		pass
solve()


I = lambda : map(int, input().split())
(t,) = I()
for _ in [0] * t:
	(n, k, z) = I()
	(*s,) = I()
	p = [0]
	for i in s:
		p += (p[-1] + i,)
	i = A = 0
	while k:
		x = min(k // 2, z)
		y = min((k + 1) // 2, z + 1)
		A = max(A, p[i + 1] + x * s[i] + y * s[i + 1] + max(0, p[i + k - x - y + 2] - p[i + 2]))
		k -= 1
		i += 1
	print(A)


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	stack = []
	hashm = {}
	arr = []
	heapq.heapify(arr)
	for test in range(tests):
		[n, k, z] = inlt()
		a = inlt()
		ans = 0
		n = min(n, k + 1)
		pre = [0]
		for i in a:
			pre.append(i + pre[-1])
		pre.pop(0)
		for i in range(1, n):
			l_move = k - i
			m_move = 2 * z
			if l_move > m_move:
				curr = (a[i] + a[i - 1]) * z + pre[k - 2 * z]
			elif l_move % 2 == 0:
				curr = (a[i] + a[i - 1]) * (l_move // 2) + pre[i]
			else:
				curr = (a[i] + a[i - 1]) * (l_move // 2) + pre[i] + a[i - 1]
			ans = max(ans, curr)
		ans = max(ans, pre[min(n - 1, k + 1)])
		print(ans)
main()


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	s = [0] * (n + 1)
	for i in range(n):
		s[i + 1] = s[i] + a[i]
	ans = s[k + 1]
	for i in range(1, n):
		offset = s[i]
		tmp = 0
		tt = min(z, k // 2)
		tmp = a[i - 1] * tt + a[i] * tt
		tmp += s[i + k - tt * 2] - s[i]
		ans = max(ans, tmp + offset)
		k -= 1
		if k == 0:
			break
	print(ans)


from itertools import accumulate
from math import ceil
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	score = a[0]
	pf = list(accumulate(a))
	for i in range(1, 1 + k):
		sc = pf[i - 1]
		rem = 1 + k - i
		if rem // 2 >= z:
			sc += a[i - 1] * z + a[i] * z
			rem -= 2 * z
			sc += pf[i + rem - 1] - pf[i - 1]
		else:
			sc += a[i - 1] * (rem // 2) + a[i] * ceil(rem / 2)
		score = max(score, sc)
	print(score)


import heapq
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	(*arr,) = map(int, input().split())
	s = arr[0]
	max_pair = arr[0] + arr[1]
	ans = s + min(z, k // 2) * max_pair
	for i in range(1, k + 1):
		s += arr[i]
		if i < n - 1:
			max_pair = max(max_pair, arr[i] + arr[i + 1])
		ans = max(ans, s + min(z, (k - i) // 2) * max_pair)
	print(ans)


T = int(input())
for _ in range(T):
	(n, k, z) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	ans = 0
	for i in range(z + 1):
		ans1 = 0
		_max = 0
		pos = k - 2 * i
		if pos < 0:
			continue
		for j in range(pos + 1):
			if j < n - 1:
				_max = max(arr[j] + arr[j + 1], _max)
		ans1 += sum(arr[0:pos + 1])
		ans1 += _max * i
		ans = max(ans1, ans)
	print(ans)


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for xyz in range(0, int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	pre = [l[0]]
	for i in range(1, n):
		pre.append(l[i] + pre[i - 1])
	ans = pre[k]
	for i in range(1, k):
		ml = k - i
		mb = min(z, (ml + 1) // 2)
		ca = pre[i]
		if mb != 0:
			ca += (mb - 1) * l[i] + mb * l[i - 1]
			ml -= 2 * mb - 1
			ca += pre[i + ml - 1] - pre[i - 1]
		ans = max(ans, ca)
	print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		(n, k, z) = LI()
		a = LI()
		r = sum(a[:k + 1])
		m = 0
		for i in range(1, n):
			t = a[i] + a[i - 1]
			m = max(m, t)
			if i == k + 1 - z * 2 - 1:
				l = sum(a[:k + 1 - z * 2]) + z * m
				if r < l:
					r = l
			if i < k + 1 - z * 2 - 1:
				continue
			if t != m:
				continue
			kk = min(z, (k + 1 - i) // 2)
			if kk < 1:
				break
			l = t * kk + sum(a[:k + 1 - kk * 2])
			if r < l:
				r = l
		rr.append(r)
	return JA(rr, '\n')
print(main())


def solve(a, k, z):
	r = sum(a[:k])
	if z > 0:
		r += max((a[i] + a[i + 1] for i in range(k))) * z
	return r
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	print(max((solve(a, k - z * 2 + 1, z) for z in range(z + 1) if z * 2 <= k)))


def f(a, s, kk):
	suma = sum(a)
	n = len(a)
	sol = suma
	for k in range(1, kk + 1):
		if n - 2 * k + 1 < 0:
			break
		ssol = suma - sum(a[n - 2 * k + 1:])
		ssol += a[n - 2 * k - 1]
		for i in s:
			if i[1] <= n - 2 * k - 1:
				ssol += i[0] * (k - 1)
				break
		if n - 2 * k < 0:
			break
		tmp = suma - sum(a[n - 2 * k:])
		for i in s:
			if i[1] <= n - 2 * k - 2:
				tmp += i[0] * k
				break
		sol = max(sol, tmp, ssol)
	return sol
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))[:k + 1]
	s = [(a[i] + a[i + 1], i) for i in range(len(a) - 1)]
	s.sort()
	s.reverse()
	print(f(a, s, z))


import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
con = 10 ** 9 + 7
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def main():
	T = int(input())
	for _ in range(T):
		(N, K, Z) = getlist()
		A = getlist()
		Asum = [0] * N
		Asum[0] = A[0]
		for i in range(1, N):
			Asum[i] = Asum[i - 1] + A[i]
		B = [0] * N
		for i in range(1, N):
			B[i] = A[i] + A[i - 1]
		for i in range(1, N):
			B[i] = max(B[i], B[i - 1])
		ans = 0
		for i in range(Z + 1):
			val = K - 2 * i + 1
			if K - 2 * i >= 0:
				ans = max(ans, Asum[K - 2 * i] + B[min(val, N - 1)] * i)
			else:
				break
		print(ans)
main()


def prefix_sum(array):
	presum = []
	presum.append(0)
	for i in range(1, len(array) + 1):
		presum.append(array[i - 1] + presum[i - 1])
	return presum

def fun(arr, ps, k, z):
	ans = 0
	for i in range(2, len(arr) + 1):
		req = i - 1
		if req > k:
			break
		rem = k - req
		tot = min(rem, 2 * z)
		x = arr[i - 1] + arr[i - 2]
		sco = tot // 2 * x + tot % 2 * arr[i - 2]
		rem -= tot
		sco += ps[i + rem]
		ans = max(ans, sco)
	return ans
for i in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = [int(i) for i in input().split()][:n]
	ps = prefix_sum(arr)
	print(fun(arr, ps, k, z))


import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	(ans, sum, nax) = (0, 0, 0)
	for i in range(k + 1):
		if i < n - 1:
			nax = max(nax, a[i] + a[i + 1])
		sum += a[i]
		if i & 1 == k & 1:
			cnt = (k - i) // 2
			if cnt <= z:
				ans = max(ans, sum + nax * cnt)
	print(ans)


q = int(input())
for i in range(q):
	(n, k, z) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	sp = [arr[i] + arr[i + 1] for i in range(len(arr) - 1)]
	res = sum(arr[:k + 1])
	for j in range(z, 0, -1):
		if k + 1 - 2 * j > 0 and k + 1 - 2 * j > 0:
			res = max(res, j * max(sp[:k - 2 * j + 1]) + sum(arr[:k + 1 - 2 * j]))
	print(res)


t = int(input())
for _ in range(0, t):
	s = input().split(' ')
	n = int(s[0])
	k = int(s[1])
	z = int(s[2])
	a = list(map(int, input().split()))
	dyn = {}
	dyn[0, 0, z] = a[0]
	ans = 0
	for j in range(0, k):
		new_dyn = {}
		for ((i, l, _z), val) in dyn.items():
			if i > 0 and l == 0 and (_z > 0):
				st = (i - 1, 1, _z - 1)
				if st not in new_dyn or new_dyn[st] < val + a[i - 1]:
					new_dyn[st] = val + a[i - 1]
					ans = max(ans, new_dyn[st])
			st = (i + 1, 0, _z)
			if st not in new_dyn or new_dyn[st] < val + a[i + 1]:
				new_dyn[st] = val + a[i + 1]
				ans = max(ans, new_dyn[st])
		dyn = new_dyn
	print(ans)


N = int(input().strip())
for i in range(N):
	(n, k, Z) = map(int, input().strip().split())
	score_list = list(map(int, input().strip().split()))
	compare = [score_list[i] + score_list[i + 1] for i in range(k)]
	result = [0, 0, 0, 0, 0, 0]
	if k % 2 == 1:
		for z in range(min(6, int((k + 1) / 2))):
			if z == 0:
				result[z] = sum(score_list[:k + 1])
			else:
				result[z] = sum(score_list[:k + 1 - 2 * z]) + z * max(compare[:k + 1 - 2 * z])
	else:
		for z in range(min(6, int(k / 2) + 1)):
			if z == 0:
				result[z] = sum(score_list[:k + 1])
			elif z == int(k / 2):
				result[z] = z * sum(score_list[:2]) + score_list[0]
			else:
				result[z] = sum(score_list[:k + 1 - 2 * z]) + z * max(compare[:k + 1 - 2 * z])
	print(max(result[:Z + 1]))


import io
import os
import sys
from collections import deque, defaultdict
from itertools import accumulate

def _input():
	x = sys.stdin.readline()
	x = x.replace('\r', '')
	x = x.replace('\n', '')
	return x
if 'STDINPUT' not in os.environ:
	input = _input
else:
	print('Standard input')

def solve():
	(n, k, z) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()][:k + 1]
	p = list(accumulate(a, lambda x, y: x + y))
	(cans, ans) = (0, p[-1])
	for i in range(k):
		cans = p[i]
		steps = min(z << 1, k - i)
		cans += steps // 2 * (a[i] + a[i + 1])
		steps = steps >> 1 << 1
		cans += p[k - steps] - p[i]
		ans = max(ans, cans)
	print(ans)
test_cases = True
if test_cases:
	_q = int(input())
	for _ in range(_q):
		solve()
else:
	solve()


def solve():
	(n, steps, left) = map(int, input().split())
	scores = [int(x) for x in input().split()]
	sum = 0
	ans = 0
	maxPair = 0
	for i in range(steps + 1):
		if i < n - 1:
			maxPair = max(maxPair, scores[i] + scores[i + 1])
		sum += scores[i]
		if i % 2 == steps % 2:
			t = (steps - i) // 2
			if t <= left:
				ans = max(ans, sum + maxPair * t)
	print(ans)
for case in range(int(input())):
	solve()


t = int(input())
for _ in range(t):
	(n, k, z) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	z1 = []
	z2 = 0
	max1 = 0
	for i in range(n):
		z2 += a[i]
		z1 += [z2]
	if z == 0 or k == 1:
		print(z1[k])
	else:
		i = 1
		t1 = z1[i]
		k1 = 1
		k2 = k1
		while i < n and k1 <= k:
			t1 = z1[i]
			k2 = k1
			t2 = t1
			if 2 * z < k - k2:
				t2 += a[i] * z
				t2 += a[i - 1] * z
				k2 += 2 * z
				if k2 < k:
					t2 += z1[i + (k - k2)] - z1[i]
			else:
				t2 += a[i] * ((k - k2) // 2)
				t2 += a[i - 1] * ((k - k2) // 2)
				if (k - k2) % 2 == 1:
					t2 += a[i - 1]
			max1 = max(max1, t2)
			i += 1
			k1 += 1
		print(max1)


R = lambda : map(int, input().split())
(t,) = R()
for _ in [0] * t:
	(n, k, z) = R()
	a = (*R(),)
	print(a[0] + max((sum(a[1:k + 1 - 2 * i]) + i * max((a[j] + a[j + 1] for j in range(k + 1 - (2 * i or 1)))) for i in range(min(z, k // 2) + 1))))


def put():
	return map(int, input().split())
n = int(input())
for _ in range(n):
	(n, k, z) = put()
	l = list(put())
	(ans, k, dp) = (0, k + 1, [])
	for i in range(k - 1):
		dp.append(l[i] + l[i + 1])
	for i in range(z + 1):
		if k - 2 * i > 0:
			ans = max(ans, sum(l[:k - 2 * i]) + i * max(dp[:k - 2 * i]))
	print(ans)


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import defaultdict
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return
mod = 10 ** 9 + 7

def solve():
	(n, k, z) = IP()
	a = L()
	mx = sum(a[:k])
	for i in range(z + 1):
		left = k - 2 * i
		if left < 0:
			continue
		sm = 0
		for j in range(left + 1):
			sm += a[j]
		repeat = 0
		for j in range(1, left + 2):
			if j > n - 1:
				break
			repeat = max(repeat, a[j] + a[j - 1])
		mx = max(mx, sm + repeat * i)
	P(mx)
	return
t = II()
for i in range(t):
	solve()


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
MOD = 998244353
T = int(stdin.readline())
for _ in range(T):
	(n, k, Z) = list(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	pre = [a[0]]
	mx = [0]
	for i in range(n - 1):
		pre.append(pre[i] + a[i + 1])
		mx.append(max(a[i] + a[i + 1], mx[i]))
	ans = [-1] * 6
	ans[0] = pre[k]
	for z in range(1, Z + 1, 1):
		if k - 2 * z < 0:
			break
		tmp = pre[k - 2 * z]
		tmp += z * mx[k - 2 * z + 1]
		ans[z] = tmp
	print(max(ans))


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return list(map(str, input().strip()))

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter, deque
import math
import heapq
from heapq import heappop, heappush
import bisect
from itertools import groupby
from itertools import permutations as comb

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

def lcm(a, b):
	return a // gcd(a, b) * b

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = I()
	return n

def dfs(i, p, d):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n // i
	if n > 2:
		l.append(n)
	return l
from math import inf
n = I()
for _ in range(n):
	(n, k, z) = lint()
	s = lint()
	c = [0] * n
	c[0] = s[0]
	for i in range(1, n):
		c[i] += c[i - 1] + s[i]
	ans = 0
	for i in range(1, min(n, k + 1)):
		tmp = k - i
		p = min(tmp // 2, z)
		q = c[i] + p * (s[i] + s[i - 1])
		tmp -= 2 * p
		idx = i
		if z - p and tmp:
			q += s[i - 1]
			idx = i - 1
			tmp -= 1
		q += c[min(idx + tmp, n - 1)] - c[idx]
		ans = max(ans, q)
	print(ans)


import sys

def main():
	length = int(sys.stdin.readline())
	for i in range(length):
		(n, k, z) = map(int, input().split())
		a = (lambda x: [int(i) for i in x])(input().split())
		ans = 0
		for left in range(z + 1):
			end_pos = k - 2 * left
			max_ = 0
			s = 0
			for i in range(end_pos + 1):
				if i < n - 1:
					max_ = max(max_, a[i] + a[i + 1])
				s += a[i]
			ans = max(ans, s + max_ * left)
		print(ans)
main()


import collections

def sort(key):
	return len(key[1])

def solve(lst, p, l):
	stck = []
	mx = 0
	sm = 0
	ans = 0
	for i in range(p + 1):
		if i < len(lst) - 1:
			mx = max(mx, lst[i] + lst[i + 1])
		sm += lst[i]
		if i % 2 == p % 2:
			m = (p - i) // 2
			if m <= l:
				ans = max(ans, mx * m + sm)
	return ans
ans = []
n = int(input())
for i in range(n):
	(n, p, l) = map(int, input().split())
	lst = list(map(int, input().split()))
	print(solve(lst, p, l))
for i in ans:
	print(i)


n = int(input())
for i in range(n):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	s = sum(l[:k + 1])
	m = [l[i] + l[i - 1] for i in range(1, k + 1)]
	ans = s
	for i in range(1, z + 1):
		c = s
		if 1 + k - 2 * (i - 1) >= 1 and (i - 1) * 2 + 1 <= len(m):
			c = c - sum(l[1 + k - 2 * (i - 1):1 + k]) - m[-(i - 1) * 2 - 1]
			if len(m[:-(i - 1) * 2 - 1]) > 1:
				c += max(m[:-(i - 1) * 2 - 1]) * i
			else:
				c += m[0] * i
			ans = max(ans, c)
	print(ans)


import sys
input = sys.stdin.readline
from functools import lru_cache
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	R = A[:k + 1]
	n = len(R)
	for i in range(n - 2, -1, -1):
		R[i] += R[i + 1]
	DP = [[0] * n for _ in range(z + 1)]
	for used in range(z, -1, -1):
		for i in range(n - 1, -1, -1):
			rem = k - i - 2 * used
			if rem <= 0:
				continue
			best = A[i + 1] + DP[used][i + 1]
			if i > 0 and used < z:
				if rem == 1:
					best = max(best, A[i - 1])
				else:
					best = max(best, A[i - 1] + A[i] + DP[used + 1][i])
			DP[used][i] = best
	print(A[0] + DP[0][0])
	continue

	@lru_cache(maxsize=None)
	def f(i, rl):
		rem = k - i - 2 * (z - rl)
		if rem == 0:
			return 0
		best = A[i + 1] + f(i + 1, rl)
		if i > 0 and rl:
			if rem == 1:
				best = max(best, A[i - 1])
			else:
				best = max(best, A[i - 1] + A[i] + f(i, rl - 1))
		return best
	print(A[0] + f(0, z))
	continue
	full = sum(A[1:k + 1])
	best = full
	for i in range(k):
		hs = 0
		l = 0
		em = 0
		while rm + em < k:
			tscore = best


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	ANS = sum(A[:k + 1])
	for gc in range(1, z + 1):
		MAX = 0
		if k + 1 - gc * 2 <= 0:
			break
		for i in range(k - 2 * gc + 1):
			MAX = max(MAX, A[i] + A[i + 1])
		ANS = max(ANS, sum(A[:k + 1 - gc * 2]) + MAX * gc)
	print(ANS)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	ar = list(map(int, input().split()))
	li = [ar[0]]
	for i in range(1, n):
		li.append(ar[i] + li[-1])
	ans = li[k]
	ind = k + 1
	zz = z
	while z:
		rev = zz - z + 1
		ind -= 2
		if k + 1 - 2 * rev <= 0:
			break
		ma = ar[0] + ar[1]
		for i in range(ind):
			if ar[i] + ar[i + 1] >= ma:
				ma = ar[i] + ar[i + 1]
		z -= 1
		ans = max(li[ind - 1] + ma * rev, ans)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	s = list(map(int, input().split()))
	ans = 0
	for pair in range(z + 1):
		mxp = k - 2 * pair + 1
		if mxp <= 0:
			continue
		(mx, temp) = (0, 0)
		for i in range(mxp):
			temp += s[i]
			if i < n - 1:
				mx = max(mx, s[i] + s[i + 1])
		ans = max(ans, pair * mx + temp)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = tuple((int(x) for x in input().split()))
	arr = [int(x) for x in input().split()]
	mx = 0
	for x in range(z + 1):
		(m1, m2) = (0, 0)
		ans = 0
		for i in range(k + 1 - x * 2):
			ans += arr[i]
			if i + 1 < n:
				m1 = max(m1, arr[i] + arr[i + 1])
		ans += m1 * x
		mx = max(mx, ans)
	print(mx)


from sys import stdin, gettrace
from itertools import accumulate
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	(n, k, z) = map(int, inputi().split())
	aa = [int(a) for a in inputi().split()][:k + 1]
	saa = list(accumulate(aa))
	best = saa[-1]
	for i in range(1, k):
		v = saa[i]
		count = i + 1
		rep = min(z, (k - count + 1) // 2)
		v += (aa[i] + aa[i - 1]) * rep
		count += rep * 2
		if count == k and rep < z:
			v += max(aa[i + 1], aa[i - 1])
		else:
			v += saa[i + k + 1 - count] - saa[i]
		best = max(v, best)
	print(best)

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	cons = []
	for i in range(1, k + 1):
		cons.append(arr[i] + arr[i - 1])
	out = []
	while z > -1:
		if k - 2 * z + 1 > 0:
			m = max(cons[:k - 2 * z + 1])
			out.append(sum(arr[:k - 2 * z + 1]) + z * m)
		z -= 1
	print(max(out))


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	p = [a[0]]
	for i in range(1, n):
		p.append(p[-1] + a[i])
	s = p[k]
	for i in range(1, k + 1):
		k -= 1
		r = k
		cs = 0
		cz = z
		m = 0
		while r > 0:
			if m % 2 == 0:
				if cz > 0:
					cs += a[i - 1]
					cz -= 1
				else:
					break
			else:
				cs += a[i]
			r -= 1
			s = max(s, cs + p[i + r - 1])
			m += 1
		s = max(s, cs + p[i + r])
	print(s)


import sys
readline = sys.stdin.readline

def solve():
	(N, K, Z) = map(int, readline().split())
	A = list(map(int, readline().split()))
	dp = [[0] * (2 * (Z + 1)) for i in range(N)]
	dp[0][0] = A[0]
	for i in range(1, N):
		dp[i][0] = dp[i - 1][0] + A[i]
	for j in range(1, Z + 1):
		for i in range(N - 1):
			dp[i][j * 2 + 1] = max(dp[i + 1][(j - 1) * 2], dp[i + 1][(j - 1) * 2 + 1]) + A[i]
		for i in range(1, N):
			dp[i][j * 2] = max(dp[i - 1][j * 2], dp[i - 1][j * 2 + 1]) + A[i]
	ans = max((max(dp[K - 2 * i][i * 2], dp[K - 2 * i][i * 2 + 1]) for i in range(Z + 1) if K - 2 * i >= 0))
	print(ans)
T = int(readline())
for i in range(T):
	solve()


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [0] * n
	c = [0] * n
	c[0] = a[0]
	for i in range(1, n):
		b[i] = max(b[i - 1], a[i] + a[i - 1])
		c[i] = a[i] + c[i - 1]
	ans = 0
	for i in range(z + 1):
		if k - 2 * i > 0:
			if k - 2 * i < n - 1:
				ans = max(ans, c[k - 2 * i] + i * b[k - 2 * i + 1])
			else:
				ans = max(ans, c[k - 2 * i] + i * b[k - 2 * i])
		elif k - 2 * i == 0:
			ans = max(ans, c[k - 2 * i] + i * b[k - 2 * i + 1])
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for x in range(z + 1):
		pos = k - 2 * x
		if pos < 0:
			continue
		m = 0
		s = 0
		for i in range(pos + 1):
			if i < n - 1:
				m = max(m, a[i] + a[i + 1])
			s += a[i]
		ans = max(ans, s + x * m)
	print(ans)


import math
import copy
t = int(input())
for i in range(t):
	(n, k, z) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [a[x] + a[x - 1] for x in range(1, k)]
	maxi = 0
	for i in range(z + 1):
		if k > -1:
			suma = sum(a[:k + 1])
		else:
			suma = 0
		maxi = max(maxi, suma)
		k -= 2
		try:
			suma += max(b) * i
		except:
			break
		if i != 0:
			b = b[:-2]
		maxi = max(maxi, suma)
	print(maxi)


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	(n, k, z) = list(map(int, input().rstrip().split(' ')))
	arr = list(map(int, input().rstrip().split(' ')))
	prefixArr = [0] * (n + 1)
	for i in range(1, n + 1):
		prefixArr[i] = prefixArr[i - 1] + arr[i - 1]
	bestTotal = prefixArr[k + 1]
	currentTotal = 0
	for i in range(0, k):
		currentTotal += arr[i]
		remainingMoves = k - i
		remainingLoopMoves = min(z, remainingMoves // 2)
		totalRemaining = 0
		loopTotal = (arr[i] + arr[i + 1]) * remainingLoopMoves
		remainingMoves = remainingMoves - remainingLoopMoves * 2
		if remainingMoves > 0:
			totalRemaining = prefixArr[i + remainingMoves + 1] - prefixArr[i + 1]
		totalTotal = currentTotal + loopTotal + totalRemaining
		if totalTotal > bestTotal:
			bestTotal = currentTotal + loopTotal + totalRemaining
	print(bestTotal)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	final = 0
	for i in range(z + 1):
		p = k - 2 * i
		mx = s = 0
		for j in range(p + 1):
			if j < n - 1:
				mx = max(mx, arr[j] + arr[j + 1])
			s += arr[j]
		final = max(final, s + mx * i)
	print(final)


import math
a = int(input())
for i in range(a):
	(n, k, m) = map(int, input().split())
	dp = [[[-math.inf for i in range(2)] for i in range(m + 1)] for i in range(k + 1)]
	z = list(map(int, input().split()))
	maxa = 0
	for i in range(1, k + 1):
		if i == 1:
			dp[i][0][0] = z[0] + z[1]
			maxa = max(maxa, dp[i][0][0])
		else:
			dp[i][0][0] = dp[i - 1][0][0] + z[i]
			maxa = max(maxa, dp[i][0][0])
	for j in range(1, m + 1):
		for i in range(1, k + 1):
			if i >= 2 * j:
				forw = i - j
				back = j
				dp[i][j][1] = dp[i - 1][j - 1][0] + z[forw - back]
				maxa = max(maxa, dp[i][j][1])
			forw = i - j
			back = j
			if forw - back >= 0:
				dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][1]) + z[forw - back]
				maxa = max(maxa, dp[i][j][0])
	print(maxa)


from sys import stdin

def r():
	return stdin.readline().strip()

def r_t(tp):
	return map(tp, r().strip().split())

def r_a(tp):
	return list(r_t(tp))

def solve(n, k, z, A):
	ans = float('-inf')
	for t in range(0, z + 1):
		(ac, x) = (0, -1)
		for i in range(k - 2 * t + 1):
			ac += A[i]
			if i < n - 1:
				x = max(x, A[i] + A[i + 1])
		ac += x * t
		ans = max(ans, ac)
	return ans

def main():
	cases = int(r())
	for _ in range(cases):
		(n, k, z) = r_t(int)
		A = r_a(int)
		print(solve(n, k, z, A))
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	b = []
	for i in range(n - 1):
		b.append(a[i] + a[i + 1])
	mx = 0
	c = []
	for i in b:
		mx = max(mx, i)
		c.append(mx)
	total = sum(a[:k + 1])
	ans = total
	for i in range(1, z + 1):
		if k - 1 - i * 2 >= 0:
			ans = max(ans, total + i * c[k - 1 - i * 2] - sum(a[k - i * 2 + 1:k + 1]))
		if k - i * 2 >= 0:
			ans = max(ans, total + i * b[k - i * 2] - sum(a[k - i * 2 + 1:k + 1]))
	print(ans)


T = int(input())
for _ in range(T):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	m = 0
	c = [a[0]]
	for i in range(1, k + 1):
		c.append(c[-1] + a[i])
	p = []
	for i in range(k):
		p.append(a[i] + a[i + 1])
	if z == 0:
		print(c[-1])
	else:
		ans = c[-1]
		for i in range(k):
			j = 1
			while j <= min(z, (k - i) / 2) and -2 * j >= -k:
				t = c[-2 * j - 1]
				t += p[i] * j
				if t > ans:
					ans = t
				j += 1
		print(ans)


from sys import stdin, stdout
import math
t = int(stdin.readline())
for _ in range(t):
	(n, k, z) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	i = 0
	ans = 0
	psum = [0]
	for num in a:
		psum.append(psum[-1] + num)
	for i in range(1, n):
		tmp = psum[i]
		if i > k:
			break
		m = i - 1
		for j in range(z):
			if m < k:
				tmp += a[i]
				m += 1
			if m < k:
				tmp += a[i - 1]
				m += 1
		if m < k:
			tmp += psum[i + k - m] - psum[i]
		ans = max(ans, tmp)
	print(ans)


def solve(n, k, z, ar):
	ans = 0
	for t in range(z + 1):
		pos = k - 2 * t
		if pos < 0:
			continue
		maxi = 0
		s = 0
		for i in range(pos + 1):
			if i < n - 1:
				maxi = max(ar[i] + ar[i + 1], maxi)
			s += ar[i]
		ans = max(ans, s + maxi * t)
	print(ans)
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	ar = list(map(int, input().split()))
	solve(n, k, z, ar)


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	a = [int(v) for v in input().split()]
	m = 0
	y = z
	q = min(k, n - 1)
	p = 0
	if z >= 1:
		dp = [0]
		for j in range(0, n):
			dp.append(dp[-1] + a[j])
		for j in range(0, min(k, n - 1)):
			p = a[j] + a[j + 1]
			p = p + dp[j]
			z = k - j - 1
			te = y
			while z > 0 and te > 0:
				p = p + a[j]
				z = z - 1
				te = te - 1
				if z > 0:
					p = p + a[j + 1]
					z = z - 1
				else:
					break
			if z > 0:
				p = p + dp[j + 2 + z] - dp[j + 2]
			if p > m:
				m = p
	if y == 0:
		print(sum(a[:min(n, k + 1)]))
	else:
		print(m)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('../output.txt', 'w')
except:
	pass
for _ in range(int(input())):
	(n, k, z) = L()
	A = L()
	ans = 0
	for times in range(z + 1):
		here = 0
		sum = 0
		for i in range(0, k - 2 * times + 1):
			if i != 0:
				here = max(here, A[i] + A[i - 1])
			sum += A[i]
		ans = max(ans, sum + times * here)
		if times != 0:
			sum = 0
			for i in range(0, k - 2 * times + 2):
				sum += A[i]
			if k - 2 * times >= 0:
				ans = max(ans, sum + times * A[k - 2 * times] + (times - 1) * A[k - 2 * times + 1])
	print(ans)


t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	z = int(l[2])
	l = input().split()
	li = [int(i) for i in l]
	maxa = 0
	for i in range(z + 1):
		if k - 2 * i <= 0:
			continue
		sumi = li[0]
		maxpairsum = 0
		for j in range(1, k - 2 * i + 1):
			maxpairsum = max(maxpairsum, li[j] + li[j - 1])
			sumi += li[j]
		maxa = max(maxa, sumi + i * maxpairsum)
	for i in range(1, z + 1):
		if k - 2 * i + 1 <= 0:
			continue
		sumi = li[0]
		for j in range(1, k - 2 * i + 2):
			sumi += li[j]
		maxa = max(maxa, sumi + i * li[k - 2 * i] + (i - 1) * li[k - 2 * i + 1])
	print(maxa)


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	scores = list(map(int, input().split()))
	maxscore = 0
	bestpair = [scores[0] + scores[1], 1, scores[0] + scores[1]]
	trngscore = 0
	score = scores[0]
	for j in range(1, k + 1 - 2 * z):
		score += scores[j]
		if scores[j] + scores[j - 1] >= bestpair[0]:
			bestpair = [scores[j] + scores[j - 1], j, score]
	if z and k + 1 - 2 * z > 1:
		trngscore = bestpair[2] + z * bestpair[0]
		rest = k - bestpair[1] - 2 * z
		for t in range(bestpair[1] + 1, bestpair[1] + 1 + rest):
			trngscore += scores[t]
		maxscore = trngscore
	rest = k + 1 - 2 * z
	if k + 1 - 2 * z <= 1:
		rest = 1
	for j in range(rest, k + 1):
		score += scores[j]
		if scores[j] + scores[j - 1] >= bestpair[0] and z:
			if (k - j) % 2:
				trngscore = score + (k - j) // 2 * scores[j]
				trngscore += (1 + (k - j) // 2) * scores[j - 1]
			else:
				trngscore = score + (k - j) // 2 * (scores[j] + scores[j - 1])
		if trngscore > maxscore:
			maxscore = trngscore
	if score > maxscore:
		maxscore = score
	print(maxscore)


t = int(input())
for i in range(t):
	(n, K, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	mx1 = 0
	for j in range(z + 1):
		v = a[0]
		mx1 = 0
		aj = 0
		for k in range(1, K - 2 * j + 1):
			v = v + a[k]
			sum = a[k] + a[k - 1]
			mx1 = max(sum, mx1)
			if sum == mx1 and k == K - 2 * j - 1:
				aj = 37
		v += mx1 * j
		if j < z and aj == 37:
			ans = max(ans, v, v - a[K - 2 * j] + a[K - 2 * j - 2])
		else:
			ans = max(ans, v)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	pairSum = [[i, i + 1] for i in range(n - 1)]
	pairSum.sort(key=lambda x: arr[x[0]] + arr[x[1]])
	sumUptoK = sum(arr[:k + 1])
	ans = sumUptoK
	for leftMoves in range(1, z + 1):
		if k < 2:
			break
		sumUptoK -= arr[k] + arr[k - 1]
		k -= 2
		temp = sumUptoK
		while True:
			if not pairSum:
				break
			if pairSum[-1][1] <= k + 1:
				ans = max(ans, sumUptoK + (arr[pairSum[-1][0]] + arr[pairSum[-1][1]]) * leftMoves)
				break
			else:
				pairSum.pop()
	print(ans)


for _ in range(int(input())):
	(n, k, z) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	pref = [arr[0]]
	for i in range(1, len(arr)):
		pref.append(pref[-1] + arr[i])
	ans = arr[0]
	for i in range(1, k + 1):
		kleft = k - i
		here_sum = pref[i]
		adj_sum = arr[i - 1] + arr[i]
		left = min(z, kleft // 2)
		here_sum += adj_sum * left
		krem = kleft - left * 2
		zrem = z - left
		if krem > 0 and zrem > 0:
			here_sum += pref[i - 1 + krem - 1] - pref[i - 1] + arr[i - 1]
		elif krem > 0:
			here_sum += pref[i + krem] - pref[i]
		ans = max(ans, here_sum)
	print(ans)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
import math as mt

def main():
	(t,) = I()
	for _ in range(t):
		(n, k, x) = I()
		l = I()
		if x == 0:
			print(sum(l[:k + 1]))
		else:
			te = l[:k + 1]
			ans = sum(te)
			d = max(te)
			su = 0
			used = 0
			pr = list(te)
			for i in range(1, k):
				pr[i] += pr[i - 1]
			for i in range(k):
				if i - 1 >= 0:
					su = pr[i]
					if x + (x - 1) + i <= k:
						le = x
					else:
						st = k - i
						le = min(x, st // 2 + st % 2)
					su += le * te[i - 1]
					su += (le - 1) * te[i]
					used = i + le + (le - 1)
					touse = k - used
					su += pr[i - 1 + touse] - pr[i - 1]
					ans = max(ans, su)
			print(ans)
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k, z) = list(map(int, input().split()))
	n = min(n, k + 1)
	arr = list(map(int, input().split()))
	arr = arr[:n]
	b_best = 0
	for i in range(z + 1):
		if k + 1 - 2 * i > 1:
			temp = arr[:k + 1 - 2 * i]
			bbb = []
			for j in range(len(temp) - 1):
				bbb.append(arr[j] + arr[j + 1])
			m = max(bbb)
			ss = sum(temp)
			tr = m * i + ss
			b_best = max(b_best, tr)
	z -= 1
	k -= 1
	for i in range(z + 1):
		if k + 1 - 2 * i > 1:
			temp = arr[:k + 1 - 2 * i]
			bbb = []
			for j in range(len(temp) - 1):
				bbb.append(arr[j] + arr[j + 1])
			m = max(bbb)
			ss = sum(temp)
			tr = m * i + ss + temp[-2]
			b_best = max(b_best, tr)
	print(b_best)


from sys import stdin
for _ in range(int(stdin.readline())):
	(n, k, z) = map(int, stdin.readline().split())
	arr = list(map(int, stdin.readline().split()))
	su = [0]
	for i in arr:
		su.append(su[-1] + i)
	fin = su[k + 1]
	for i in range(1, k):
		ans = su[i + 1]
		(K, Z) = (k - i, z)
		for _ in range(min(K // 2, z)):
			ans += arr[i - 1] + arr[i]
		Z -= min(K // 2, z)
		K -= min(K // 2, z) * 2
		if not K:
			fin = max(ans, fin)
		elif Z:
			fin = max(ans + arr[i - 1], ans + arr[i + 1], fin)
		else:
			fin = max(fin, ans + su[i + K + 1] - su[i + 1])
	print(fin)


arr = [1, 2, 3, 4, 5, 6]
import math
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	if not z:
		print(sum(arr[:k + 1]))
	else:
		maxx = sum(arr[:k + 1])
		summ = [0]
		ad = [0] * n
		for i in range(1, n):
			summ.append(summ[-1] + arr[i])
			ad[i] = max(ad[i - 1], arr[i] + arr[i - 1])
		z = min(z, k // 2)
		maxx = summ[k]
		c = 0
		for i in range(k - 1, 0, -1):
			if (k - i) % 2 == 0:
				c += 1
				if c <= z:
					maxx = max(maxx, summ[i] + c * ad[i])
				else:
					break
			elif c + 1 <= z:
				maxx = max(maxx, summ[i] + c * ad[i] + arr[i - 1])
		print(maxx + arr[0])


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		(n, k, z) = ain()
		a = ain()
		ans = 0
		maxi = 0
		s = 0
		if z == 0:
			print(sum(a[:k + 1]))
		else:
			for t in range(z + 1):
				pos = k - 2 * t
				if pos < 0:
					continue
				maxi = 0
				s = 0
				for i in range(pos + 1):
					if i < n - 1:
						maxi = max(maxi, a[i] + a[i + 1])
					s += a[i]
				ans = max(ans, s + t * maxi)
			print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	l = 2 * (z + 1)
	D = [[[0, -1] for j in range(l)] for _ in range(k + 1)]
	D[0][0] = [A[0], 0]
	for i in range(1, k + 1):
		for j in range(1, l, 2):
			if j - 3 >= 0:
				if D[i - 1][j - 3][1] >= 1:
					d0 = D[i - 1][j - 3][0]
					d1 = D[i - 1][j - 3][1]
					D[i][j] = [d0 + A[d1 - 1], d1 - 1]
		for j in range(0, l, 2):
			d00 = D[i - 1][j][0]
			d10 = D[i - 1][j + 1][0]
			d01 = D[i - 1][j][1]
			d11 = D[i - 1][j + 1][1]
			dm1 = max(d01, d11)
			dm0 = max(d00, d10)
			if dm1 != -1:
				D[i][j] = [dm0 + A[dm1 + 1], dm1 + 1]
	print(max([D[-1][i][0] for i in range(l)]))


def solve(a, n, k, z):
	pre = [0] * n
	pre[0] = a[0]
	for i in range(0, n):
		pre[i] = a[i] + pre[i - 1]
	ans = pre[k]
	k -= 1
	for i in range(1, n):
		if k == 0:
			break
		q = min(k, z * 2)
		ans = max(ans, (a[i] + a[i - 1]) * (q // 2) + a[i - 1] * (q % 2) + pre[i + k - q])
		k -= 1
	return ans
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = solve(a, n, k, z)
	print(ans)


from math import *
from collections import *
from random import *
from bisect import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	sc = []
	pre = [0, a[1]]
	k -= 1
	for i in range(2, n):
		pre.append(pre[-1] + a[i])
	for i in range(1, n):
		x = 0
		y = k
		zz = z
		tu = 0
		while y > 0 and zz > 0:
			if tu % 2 ^ 1:
				x += a[i - 1]
			else:
				x += a[i]
			tu += 1
			y -= 1
			if tu % 2 == 0:
				zz -= 1
		if k < 0:
			continue
		if y == 0:
			sc.append(x + a[0] + pre[i])
		else:
			x = x + a[0] + pre[i + y] - pre[i] + pre[i]
			sc.append(x)
		k -= 1
	print(max(sc))


from itertools import *
I = lambda : map(int, input().split())
(t,) = I()
for _ in [0] * t:
	(n, k, z) = I()
	(*s,) = I()
	p = [0] + [*accumulate(s)]
	i = A = c = 0
	while k:
		c += s[i]
		x = min(k // 2, z)
		y = min((k + 1) // 2, z + 1)
		A = max(A, c + x * s[i] + y * s[i + 1] + max(0, p[i + k - x - y + 2] - p[i + 2]))
		k -= 1
		i += 1
	print(A)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
import sys
sys.setrecursionlimit(250000)
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

@iterative
def rec(a, dp, pos, k, z):
	if k == 0 or pos >= len(a) or pos < 0:
		yield 0
	if dp[pos][z] != -1:
		yield dp[pos][z]
	temp = (yield rec(a, dp, pos + 1, k - 1, z))
	val = a[pos + 1] + temp
	if pos > 0 and z > 0:
		temp = (yield rec(a, dp, pos - 1, k - 1, z - 1))
		val = max(val, a[pos - 1] + temp)
	dp[pos][z] = val
	yield val

def solve():
	(n, k, z) = sep()
	a = lis()
	dp = [[-1] * (z + 1) for i in range(n + 1)]
	print(a[0] + rec(a, dp, 0, k, z))
testcase(int(inp()))


from math import inf, log2

class SegmentTree:

	def __init__(self, array, func=max):
		self.n = len(array)
		self.size = 2 ** (int(log2(self.n - 1)) + 1) if self.n != 1 else 1
		self.func = func
		self.default = 0 if self.func != min else inf
		self.data = [self.default] * (2 * self.size)
		self.process(array)

	def process(self, array):
		self.data[self.size:self.size + self.n] = array
		for i in range(self.size - 1, -1, -1):
			self.data[i] = self.func(self.data[2 * i], self.data[2 * i + 1])

	def query(self, alpha, omega):
		if alpha == omega:
			return self.data[alpha + self.size]
		res = self.default
		alpha += self.size
		omega += self.size + 1
		while alpha < omega:
			if alpha & 1:
				res = self.func(res, self.data[alpha])
				alpha += 1
			if omega & 1:
				omega -= 1
				res = self.func(res, self.data[omega])
			alpha >>= 1
			omega >>= 1
		return res

	def update(self, index, value):
		index += self.size
		self.data[index] = value
		index >>= 1
		while index:
			self.data[index] = self.func(self.data[2 * index], self.data[2 * index + 1])
			index >>= 1
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	st = SegmentTree(a, func=lambda a, b: a + b)
	ans = st.query(0, k)
	for i in range(k):
		ans2 = st.query(0, i)
		zz = min(z, (k + 1 - i - 1) // 2)
		ans2 += st.query(i, i + 1) * zz
		ans2 += st.query(i + 1, i + (k + 1 - i - 1 - zz * 2))
		ans = max(ans, ans2)
	print(ans)


t = int(input())
for tt in range(t):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	p = [0] * (n + 1)
	p[0] = 0
	ans = 0
	for i in range(n):
		p[i + 1] = p[i] + l[i]
	for i in range(n - 1):
		t = p[i + 1]
		cnt = k - i
		temp = z
		ch = 1
		if cnt < 0:
			break
		while cnt and temp:
			if not ch:
				t += l[i]
				temp -= 1
				ch ^= 1
			else:
				t += l[i + 1]
				ch ^= 1
			cnt -= 1
		if not cnt:
			ans = max(ans, t)
			continue
		t += p[i + cnt + 1] - p[i + 1]
		ans = max(ans, t)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	p = [l[0]]
	for i in range(1, n):
		p.append(l[i] + p[i - 1])
	r = [0]
	for i in range(1, n):
		r.append(l[i] + l[i - 1])
	ans = 0
	y = min(n, k + 1)
	k -= 1
	for i in range(1, y):
		t = k
		temp = 0
		if t >= 2 * z:
			temp = r[i] * z
			t -= 2 * z
			temp += p[i + t]
		elif t % 2 == 0:
			temp = r[i] * (t // 2) + p[i]
		else:
			temp = r[i] * (t // 2) + l[i - 1] + p[i]
		if temp > ans:
			ans = temp
		k -= 1
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	lst = list(map(int, input().split()))
	ans = 0
	lst.append(0)
	lst.append(0)
	lst.append(0)
	for l in range(0, z + 1):
		b = k - 2 * l
		sum = 0
		mx = 0
		for i in range(0, b + 1):
			sum = sum + lst[i]
			mx = max(mx, lst[i] + lst[i + 1])
		ans = max(ans, sum + mx * l)
	print(ans)


for t in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	s = [a[0]]
	b = [0]
	c = a[0]
	for i in range(1, k + 1):
		c += a[i]
		s.append(c)
		b.append(max(b[i - 1], a[i] + a[i - 1]))
	m = 1
	k -= 2
	while m <= z and k >= 0:
		d = s[k] + m * b[k + 1]
		if d > c:
			c = d
		m += 1
		k -= 2
	print(c)


t = int(input())
for testcase in range(t):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	sumTill = []
	ss = 0
	for a in A:
		sumTill.append(ss + a)
		ss = ss + a
	total = A[0] + A[1]
	options = [(1, 1, 0, total, False)]
	maxi = total
	for i in range(1, k + 1):
		turnsTill = i
		turnsLeft = k - turnsTill
		sum2 = sumTill[i]
		backTurns = z
		backed = False
		pos = i
		while backTurns > 0 and turnsLeft > 0:
			if backed:
				sum2 += A[i]
				backed = False
				pos = i
			else:
				sum2 += A[i - 1]
				backed = True
				backTurns = backTurns - 1
				pos = i - 1
			turnsLeft = turnsLeft - 1
		sum2 += sumTill[pos + turnsLeft] - sumTill[pos]
		maxi = max(maxi, sum2)
	print(maxi)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	l.append(-100000)
	ans = l[0]
	for i in range(z + 1):
		left = k - 2 * i
		if k - 2 * i < 0:
			continue
		(t1, t2) = (0, 0)
		for j in range(left + 1):
			t1 += l[j]
		for j in range(left + 1):
			t2 = max(t2, l[j] + l[j + 1])
		ans = max(ans, t1 + i * t2)
	print(ans)


for _ in range(int(input())):
	(n, k, zz) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = 0
	for z in range(0, zz + 1):
		an = 0
		mx = 0
		for i in range(0, k - 2 * z + 1):
			an += arr[i]
			if i + 1 < n:
				mx = max(mx, arr[i] + arr[i + 1])
		an += z * mx
		ans = max(ans, an)
	print(ans)


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	(n, k, x) = map(int, input().split())
	a = list(map(int, input().split()))
	s1 = [0] * n
	s1[0] = a[0]
	for j in range(1, n):
		s1[j] = s1[j - 1] + a[j]
	curr = a[0]
	ans = a[0]
	for j in range(1, n):
		k -= 1
		curr += a[j]
		ans = max(ans, curr)
		if k == 0:
			break
		if j + 1 < n and a[j + 1] < a[j - 1] and (x > 0):
			prev = curr
			k1 = k
			d = min(int(math.ceil(k / 2)), x)
			d1 = min(x, k // 2)
			curr += d * a[j - 1] + d1 * a[j]
			k -= d + d1
			if k > 0:
				curr += s1[j + k] - s1[j]
			ans = max(ans, curr)
			curr = prev
			k = k1
	print(ans)


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	sm = 0
	y = 1
	mx = 0
	step = 0
	delta = list()
	for (o, j) in enumerate(a):
		if o == 0:
			delta.append(j)
		else:
			delta.append(delta[o - 1] + j)
	for j in a:
		if step > k:
			break
		sm += j
		mx = max(mx, sm)
		if y != 1:
			u = step
			f = z
			r = 1
			m = 0
			while u < k and (f == 0 and r == 0 or f > 0):
				if r == 1:
					r = 0
					m += a[step - 1]
					f -= 1
				else:
					m += a[step]
					r = 1
				u += 1
			mx = max(mx, sm + m)
			if r == 0 and u < k:
				mx = max(mx, sm + m + a[step])
				m += a[step]
				u += 1
			mx = max(mx, sm + m)
			if u < k:
				mx = max(mx, sm + m + delta[step + k - u] - delta[step])
			mx = max(mx, sm + m)
		y += 1
		step += 1
	print(mx)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	s = 0
	maxi = 0
	for i in range(k + 1):
		if i < n - 1:
			maxi = max(maxi, a[i] + a[i + 1])
		s += a[i]
		if i % 2 == k % 2:
			temp = (k - i) // 2
			if temp <= z:
				ans = max(ans, s + maxi * temp)
	print(ans)


import io
import os
from collections import Counter, defaultdict, deque
from functools import lru_cache
import sys
sys.setrecursionlimit(10 ** 5)
inf = float('inf')

def pack(a, b, c):
	return (a << 4) + (b << 3) + c

def solve(N, K, Z, A):
	dp = {}
	assert Z <= 5
	for moves in reversed(range(K + 1)):
		for leftsUsed in reversed(range(Z + 1)):
			for prevLefts in [0, 1]:
				rightsUsed = moves - leftsUsed
				i = rightsUsed - leftsUsed
				best = -inf
				if not 0 <= i < N or rightsUsed + leftsUsed > K:
					best = -inf
				elif rightsUsed + leftsUsed == K:
					best = A[i]
				else:
					if i > 0 and prevLefts == 0 and (leftsUsed < Z):
						best = max(best, A[i] + dp[pack(rightsUsed, 1, leftsUsed + 1)])
					if i < N - 1:
						best = max(best, A[i] + dp[pack(rightsUsed + 1, 0, leftsUsed)])
				dp[pack(rightsUsed, prevLefts, leftsUsed)] = best
	return dp[pack(0, 0, 0)]
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N, K, Z) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, K, Z, A)
	print(ans)


import sys
input = sys.stdin.readline
T = int(input())

def psum(l):
	res = [0] * (len(l) + 1)
	for i in range(1, len(res)):
		res[i] = res[i - 1] + l[i - 1]
	return res
for t in range(T):
	(N, K, Z) = [int(_) for _ in input().split()]
	A = [int(_) for _ in input().split()]
	pa = psum(A)
	answer = 0
	for lpair in range(K):
		kleft = K - lpair - 1
		times_pair = min(kleft // 2, Z)
		new_kleft = kleft - 2 * times_pair
		score_from_pair = (A[lpair] + A[lpair + 1]) * times_pair
		if new_kleft == 1 and times_pair < Z:
			current = score_from_pair + max(A[lpair], A[lpair + 2] if lpair + 2 < len(A) else 0) + pa[lpair + 2]
		else:
			current = pa[lpair + 1 + new_kleft + 1] + score_from_pair
		answer = max(current, answer)
	print(answer)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k, z_max) = map(int, input().split())
	a = [int(item) for item in input().split()]
	ans = 0
	for z in range(min(z_max + 1, (k + 1) // 2 + 1)):
		left = z
		right = 1 + k - z * 2
		ret = sum(a[:right])
		max_apair = 0
		for (a1, a2) in zip(a, a[1:right + 1]):
			max_apair = max(max_apair, a1 + a2)
		ret += left * max_apair
		ans = max(ans, ret)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	maxx = 0
	for i in range(z + 1):
		if k - 2 * i >= 0:
			(maxx, sum) = (0, 0)
			for p in range(k - 2 * i + 1):
				if p < n - 1:
					maxx = max(maxx, a[p] + a[p + 1])
				sum += a[p]
			ans = max(ans, sum + i * maxx)
	print(ans)


import sys
import math
read = sys.stdin.buffer.read
readlines = sys.stdin.buffer.readlines
t = int(input())
for case in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	INF = 10 ** 4
	dp_left_ok = [[-INF] * (1 + z) for _ in range(1 + k)]
	dp_left_ng = [[-INF] * (1 + z) for _ in range(1 + k)]
	dp_left_ng[0][0] = a[0]
	dp_left_ok[0][0] = -10 ** 4
	for j in range(z + 1):
		for i in range(1, k + 1):
			if j > 0 and i - 1 - 2 * (j - 1) >= 0:
				dp_left_ng[i][j] = dp_left_ok[i - 1][j - 1] + a[i - 2 * j]
			if i - 1 - 2 * j >= 0:
				dp_left_ok[i][j] = max(dp_left_ok[i - 1][j], dp_left_ng[i - 1][j]) + a[i - 2 * j]
	print(max(max(dp_left_ng[k]), max(dp_left_ok[k])))


from math import sqrt
for _ in range(int(input())):
	(n, k, z) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	s = [a[0]]
	for i in a[1:]:
		s.append(s[-1] + i)
	ma = a[0] + a[1]
	mai = 1
	mal = [ma]
	mali = [mai]
	for i in range(1, n):
		if a[i - 1] + a[i] > ma:
			ma = a[i - 1] + a[i]
			mai = i
			mal.append(ma)
			mali.append(mai)
	ans = 0
	for i in range(len(mal)):
		k1 = k
		before = s[mali[i]]
		k1 -= mali[i]
		cnt = min(2 * z, k1)
		if cnt % 2 == 0:
			before += cnt // 2 * (a[mali[i]] + a[mali[i] - 1])
			if cnt < k1:
				k1 -= cnt
				before += s[mali[i] + k1] - s[mali[i]]
		else:
			before += cnt // 2 * (a[mali[i]] + a[mali[i] - 1]) + a[mali[i] - 1]
		if before > ans:
			ans = before
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	rr = 0
	tt = l[0] + l[1]
	if k >= 2 * z:
		pls = sum(l[2:k - 2 * z + 1])
	if z == 0:
		print(sum(l[:k + 1]))
	else:
		for i in range(1, k + 1):
			c = k - i
			if c >= 2 * z:
				if z % 2 == 0:
					rr = max(rr, z * (l[i] + l[i - 1]) + tt + pls)
				else:
					rr = max(rr, z * (l[i] + l[i - 1]) + tt + pls)
			else:
				rr = max(rr, c // 2 * (l[i] + l[i - 1]) + c % 2 * l[i - 1] + tt)
			if i != k:
				tt += l[i + 1]
				pls -= l[i + 1]
		print(max(rr, tt))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = [0] + list(map(int, input().split()))
	dp = [[0 for i in range(n + 1)] for j in range(z + 1)]
	for i in range(z + 1):
		for j in range(1, n + 1):
			if j - 1 + i * 2 > k:
				break
			if i == 0 and j == 1:
				dp[i][j] = a[j]
			elif i == 0 or j == n:
				dp[i][j] = dp[i][j - 1] + a[j]
			elif j == 1:
				dp[i][j] = dp[i - 1][j + 1] + a[j]
			else:
				dp[i][j] = max(dp[i][j - 1] + a[j], dp[i - 1][j + 1] + a[j])
	ans = 0
	for i in range(z + 1):
		ans = max(ans, max(dp[i]))
	print(ans)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = ri()
	for _ in range(tc):
		(n, k, z) = ria()
		a = ria()
		cs = [0]
		for i in a:
			cs.append(i + cs[-1])
		zr = z
		mx = 0
		for j in range(1, k + 1):
			z = zr
			indimax2 = j
			ans = cs[j + 1]
			i = indimax2
			operations = j
			while operations < k and z > 0:
				if i != indimax2 or z == 0:
					i += 1
				else:
					i -= 1
					z -= 1
				ans += a[i]
				operations += 1
			if operations < k:
				ol = k - operations
				sai = cs[i + 1]
				saipol = cs[i + 1 + ol]
				ans += saipol - sai
			mx = max(mx, ans)
		print(mx)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


for t in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	score = 0
	for i in range(z + 1):
		uptoIndex = k - 2 * i
		if uptoIndex < 0:
			break
		maxASum = 0
		tSum = 0
		for j in range(uptoIndex + 1):
			if j != n - 1:
				maxASum = max(maxASum, a[j] + a[j + 1])
			tSum += a[j]
		score = max(score, tSum + maxASum * i)
	print(score)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	pref = l[:]
	for i in range(1, n):
		pref[i] += pref[i - 1]
	ans = 0
	for i in range(1, n):
		tot = pref[i - 1]
		rem = k - i + 1
		loop = min(2 * z, rem - rem % 2)
		rem -= abs(loop)
		if loop > 0:
			loop //= 2
			tot += loop * l[i - 1] + loop * l[i]
		if rem >= 0 and i + rem - 1 < n:
			tot += pref[i + rem - 1] - pref[i - 1]
			ans = max(ans, tot)
	print(ans)


def solve():
	(n, k, z) = map(int, input().split())
	lst = list(map(int, input().split()))
	maxsum = 0
	for zz in range(z + 1):
		sum = lst[0]
		maxn = lst[0] + lst[1]
		if k - zz * 2 < 0:
			break
		for i in range(k - zz * 2):
			if i + 2 < n:
				maxn = max(maxn, lst[i + 1] + lst[i + 2])
			sum += lst[i + 1]
		sum += maxn * zz
		maxsum = max(maxsum, sum)
	print(maxsum)
for i in range(int(input())):
	solve()


def compute_score(a, k, z):
	ans = a[0]
	pair = a[0] + a[1]
	sum_ = a[0]
	for i in range(1, k + 1):
		pair = max(pair, a[i - 1] + a[i])
		sum_ += a[i]
		lefts = min((k - i) // 2, z)
		rem = a[i - 1] if k - i - 2 * lefts > 0 and lefts < z else 0
		ans = max(ans, lefts * pair + sum_ + rem)
	print(ans)
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	compute_score(a, k, z)


from cmath import sqrt
import math
from collections import defaultdict, deque, Counter
from functools import reduce
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = [int(i) for i in input().split()]
	mx = 0
	ans = 0
	s = 0
	for t in range(z + 1):
		id = k - 2 * t
		if id < 0:
			continue
		mx = 0
		s = 0
		for i in range(id + 1):
			if i < n - 1:
				mx = max(mx, a[i] + a[i + 1])
			s = s + a[i]
		ans = max(ans, s + mx * t)
	print(ans)


test = int(input())
for t in range(test):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	prefix = []
	last = 0
	for i in range(k + 1):
		last += arr[i]
		prefix.append(last)
	maxi = 0
	cur = 0
	for i in range(1, k + 1):
		cur = prefix[i]
		steps = k - i
		zz = z
		curpos = i
		while steps > 0 and zz > 0:
			steps -= 1
			zz -= 1
			curpos -= 1
			cur += arr[curpos]
			if steps > 0:
				steps -= 1
				curpos += 1
				cur += arr[curpos]
		if steps > 0:
			cur += prefix[curpos + steps] - prefix[curpos]
		maxi = max(maxi, cur)
	print(maxi)


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter
from pprint import pprint

def main():
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = 0
	su = 0
	prefix = [0] * (n + 1)
	for i in range(n):
		prefix[i + 1] = prefix[i] + arr[i]
	for i in range(1, k + 1):
		rem = min(z, (k - i) // 2)
		t = prefix[i + 1]
		p = (arr[i - 1] + arr[i]) * rem
		r = k - i - rem * 2
		ans = max(ans, t + p + prefix[i + r + 1] - prefix[i + 1])
		if z > (k - i) // 2 and (k - i) % 2 == 1:
			ans = max(ans, t + p + arr[i - 1] + prefix[i - 1 + r] - prefix[i])
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	main()


r = lambda : map(int, input().split())
(t,) = r()
for l in [0] * t:
	(n, k, z) = r()
	a = (*r(),)
	print(max((sum(a[:k + 1 - 2 * i]) + i * max(map(sum, zip(a, a[1:k + 2 - (2 * i or k)]))) for i in range(min(z, k // 2) + 1))))


import sys
from collections import defaultdict
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	lis = list(map(int, input().split()))
	pre = [lis[0]]
	for i in range(1, n):
		pre.append(pre[-1] + lis[i])
	m = 0
	for i in range(k, 0, -1):
		s = pre[i]
		c = z
		f = 0
		for j in range(k - i):
			if f == 0:
				if c == 0:
					s += pre[i + k - i - j] - pre[i]
					break
				else:
					s += lis[i - 1]
					c -= 1
			else:
				s += lis[i]
			f = 1 - f
		m = max(m, s)
	print(m)


import math
import sys
import bisect
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	suma = l[0]
	pref = [0] * (n + 1)
	for i in range(n):
		pref[i + 1] = pref[i] + l[i]
	maxi2 = 0
	for i in range(1, n):
		(maxi1, maxi) = (0, pref[i + 1])
		rem = 0
		for j in range(1, z + 1):
			if i + j + rem <= k:
				maxi += l[i - 1]
				maxi11 = maxi
				maxi11 += pref[i + k - (i + j + rem)] - pref[i]
				maxi1 = max(maxi11, maxi1)
				rem += 1
				maxi += l[i]
				maxi11 = maxi
				maxi11 += pref[i + 1 + k - (i + j + rem)] - pref[i + 1]
				maxi1 = max(maxi11, maxi1)
		maxi2 = max(maxi1, maxi2)
	print(max(maxi2, pref[k + 1]))


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr_sum = [arr[a] + arr[a + 1] for a in range(n - 1)]
	maximum = 0
	for j in range(min(z + 1, k // 2 + 1)):
		maximum = max(sum(arr[:k - 2 * j + 1]) + max(arr_sum[:k - 2 * j + 1]) * j, maximum)
	print(maximum)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	(n, k, z) = mp()
	arr = lmp()
	arr = arr[:k + 1]
	mx = 0
	n = len(arr)
	premax = [mx]
	for i in range(n - 1):
		if arr[i] + arr[i + 1] > mx:
			mx = arr[i] + arr[i + 1]
			ind = i + 1
		premax.append(mx)
	mx = 0
	z = min(z, k // 2)
	for i in range(z + 1):
		ans = sum(arr[:k + 1 - 2 * i]) + i * premax[min(n - 1, k + 1 - 2 * i)]
		mx = max(mx, ans)
	print(mx)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	max2sum = [0, 0, 0, 0, 0, 0]
	pos = [-2] * 6
	ans = [arr[0]] * 6
	for i in range(k):
		if arr[i] + arr[i + 1] > max2sum[0]:
			max2sum[0] = arr[i] + arr[i + 1]
			pos[0] = i
	count = 1
	i = 1
	left = 0
	while count <= k:
		if i == pos[0] + 1 and left > 0:
			ans[0] += arr[i]
			left -= 1
			count += 1
			i -= 1
		else:
			ans[0] += arr[i]
			count += 1
			i += 1
	if z >= 1:
		for i in range(k - 1):
			if arr[i] + arr[i + 1] > max2sum[1]:
				max2sum[1] = arr[i] + arr[i + 1]
				pos[1] = i
		count = 1
		i = 1
		left = 1
		while count <= k:
			if i == pos[1] + 1 and left > 0:
				ans[1] += arr[i]
				left -= 1
				count += 1
				i -= 1
			else:
				ans[1] += arr[i]
				count += 1
				i += 1
	if z >= 2:
		for i in range(k - 3):
			if arr[i] + arr[i + 1] > max2sum[2]:
				max2sum[2] = arr[i] + arr[i + 1]
				pos[2] = i
		count = 1
		i = 1
		left = 2
		while count <= k:
			if i == pos[2] + 1 and left > 0:
				ans[2] += arr[i]
				left -= 1
				count += 1
				i -= 1
			else:
				ans[2] += arr[i]
				count += 1
				i += 1
	if z >= 3:
		for i in range(k - 5):
			if arr[i] + arr[i + 1] > max2sum[3]:
				max2sum[3] = arr[i] + arr[i + 1]
				pos[3] = i
		count = 1
		i = 1
		left = 3
		while count <= k:
			if i == pos[3] + 1 and left > 0:
				ans[3] += arr[i]
				left -= 1
				count += 1
				i -= 1
			else:
				ans[3] += arr[i]
				count += 1
				i += 1
	if z >= 4:
		for i in range(k - 7):
			if arr[i] + arr[i + 1] > max2sum[4]:
				max2sum[4] = arr[i] + arr[i + 1]
				pos[4] = i
		count = 1
		i = 1
		left = 4
		while count <= k:
			if i == pos[4] + 1 and left > 0:
				ans[4] += arr[i]
				left -= 1
				count += 1
				i -= 1
			else:
				ans[4] += arr[i]
				count += 1
				i += 1
	if z >= 5:
		for i in range(k - 9):
			if arr[i] + arr[i + 1] > max2sum[5]:
				max2sum[5] = arr[i] + arr[i + 1]
				pos[5] = i
		count = 1
		i = 1
		left = 5
		while count <= k:
			if i == pos[5] + 1 and left > 0:
				ans[5] += arr[i]
				left -= 1
				count += 1
				i -= 1
			else:
				ans[5] += arr[i]
				count += 1
				i += 1
	print(max(ans))


from sys import stdin, stdout
import math

def arrinp():
	return [*map(int, stdin.readline().split(' '))]

def mulinp():
	return map(int, stdin.readline().split(' '))

def intinp():
	return int(stdin.readline())

def inp():
	return stdin.readline()

def solution():
	(n, k, z) = mulinp()
	a = arrinp()
	score = a[0]
	sumarr = [0] * n
	s = 0
	for i in range(n):
		s += a[i]
		sumarr[i] = s
	dp = [0] * (n - 1)
	s = a[0]
	for i in range(n - 1):
		val = min((k - i) // 2, z)
		if val < 0:
			val = 0
		dp[i] = (a[i] + a[i + 1]) * val + sumarr[k - 2 * val]
	print(max(dp))
testcases = 1
testcases = intinp()
for _ in range(testcases):
	solution()


def solution():
	(n, k, z) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	a1 = sorted([(a[i], i) for i in range(k + 1)], reverse=True)
	sums = [a[0]]
	for i in range(1, n):
		sums.append(sums[i - 1] + a[i])
	answer = 0
	for (ai, pos) in a1:
		rest_k = k - pos
		cur_sum = sums[pos]
		tmp = -1
		if 0 < pos < n - 1:
			tmp = a[pos - 1]
			if a[pos - 1] < a[pos + 1]:
				tmp = a[pos + 1]
		elif pos > 0:
			tmp = a[pos - 1]
		elif pos < n - 1:
			tmp = a[pos + 1]
		if tmp == -1:
			continue
		steps = min(z * 2, rest_k) // 2
		cur_sum += steps * (tmp + a[pos])
		rest_k -= steps * 2
		cur_sum += sums[pos + rest_k] - sums[pos]
		answer = max(answer, cur_sum)
	print(answer)
t = int(input())
for _ in range(t):
	solution()


production = True
import sys, math, collections, bisect, itertools, heapq, decimal, random, copy, re

def input(f=0, m=0):
	if m > 0:
		return [input(f) for i in range(m)]
	else:
		l = sys.stdin.readline()[:-1]
		if f >= 10:
			u = False
			f = int(str(f)[-1])
		else:
			u = True
		if f == 0:
			p = [l]
		elif f == 1:
			p = list(map(int, l.split()))
		elif f == 2:
			p = list(map(float, l.split()))
		elif f == 3:
			p = list(l)
		elif f == 4:
			p = list(map(int, list(l)))
		elif f == 5:
			p = l.split()
		return p if u else p[0]

def out(l, f=0, n=True):
	if f == 0:
		p = str(l)
	elif f == 1:
		p = ' '.join(map(str, l))
	elif f == 2:
		p = '\n'.join(map(str, l))
	elif f == 3:
		p = ''.join(map(str, l))
	print(p, end='\n' if n else '')

def log(*args):
	if not production:
		print('$$$', end='')
		print(*args)
enu = enumerate
ter = lambda a, b, c: b if a else c
ceil = lambda a, b: -(-a // b)
flip = lambda a: a + 1 & 1

def mapl(i, f=0):
	if f == 0:
		return list(map(int, i))
	elif f == 1:
		return list(map(str, i))
	elif f == 2:
		return list(map(list, i))

def solve():
	(n, k, z) = input(1)
	a = input(1)
	b = [i + j for (i, j) in zip(a, a[1:])]
	mb = [b[0]]
	mm = b[0]
	for i in b[1:]:
		mm = max(mm, i)
		mb.append(mm)
	p = [a[0]]
	for i in a[1:]:
		p.append(i + p[-1])
	log(a)
	log('p', p)
	log('b', b)
	log('mb', mb)
	log('k', k)
	log('z', z)
	m = p[k]
	for i in range(1, k):
		e = k - i
		r = z
		c = p[i]
		while e and r:
			e -= 1
			r -= 1
			c += a[i - 1]
			if not e:
				break
			e -= 1
			c += a[i]
		log('e', i, e, c)
		if e:
			c += p[i + e] - p[i]
		log(i, c)
		m = max(m, c)
	out(m)
	log()
	return
for i in range(input(11)):
	solve()


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	x = list(map(int, input().split()))
	s = 0
	for i in range(z + 1):
		temp = 0
		p = k + 1 - 2 * i
		summ = 0
		for j in range(p):
			summ += x[j]
			if j < n - 1:
				temp = max(temp, x[j] + x[j + 1])
		temp = i * temp
		s = max(s, summ + temp)
	print(s)


from sys import stdin, stdout
from collections import defaultdict
test = int(stdin.readline())
for _ in range(test):
	(n, k, z) = map(int, stdin.readline().split())
	a = [int(x) for x in stdin.readline().split()]
	if k == n - 1 and z == 0:
		print(sum(a))
		continue
	pref = [0, a[0]]
	for i in range(1, n):
		pref.append(pref[-1] + a[i])
	suff = [0, a[-1]]
	for i in range(n - 2, -1, -1):
		suff.append(suff[-1] + a[i])
	suff = suff[::-1]
	ans = 0
	for i in range(n - 1):
		tans = pref[i + 1]
		temp = k - i
		tz = z
		ch = 1
		if temp < 0:
			break
		while temp and tz:
			if ch:
				tans += a[i + 1]
				ch ^= 1
			else:
				tans += a[i]
				tz -= 1
				ch ^= 1
			temp -= 1
		if not temp:
			ans = max(ans, tans)
			continue
		tans += pref[i + temp + 1] - pref[i + 1]
		ans = max(ans, tans)
	print(ans)


def solve(arr, k, z):
	pre = [0]
	for i in arr:
		pre.append(pre[-1] + i)
	ans = 0
	for i in range(1, len(arr)):
		moves = k - i
		s = pre[i]
		left = min(z * 2, moves)
		s += (arr[i] + arr[i - 1]) * (left // 2) + left % 2 * arr[i - 1]
		movesleft = moves - left
		s += pre[i + movesleft + 1] - pre[i]
		ans = max(ans, s)
	return ans
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))[:k + 1]
	print(solve(arr, k, z))


q = int(input())
for _ in range(q):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	S = [0]
	MZ = [0]
	for i in range(n):
		S.append(S[-1] + A[i])
		if i < n - 1:
			MZ.append(max(MZ[-1], A[i + 1] + A[i]))
	S = S[1:]
	MZ = MZ[1:]
	MZ.append(0)
	ans = 0
	for zz in range(z + 1):
		ind = k - 2 * zz
		if ind < 0:
			continue
		tmp = S[ind] + zz * MZ[ind]
		ans = max(ans, tmp)
	print(ans)


import sys
input = sys.stdin.readline
import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input().strip()
	return list(s[:len(s)])

def invr():
	return map(int, input().strip().split())

def from_file(f):
	return f.readline

def solve(A, K, Z):
	res = 0
	for t in range(Z + 1):
		s = 0
		M = 0
		for i in range(1, max(K - 2 * t + 2, 0)):
			s += A[i]
			if i + 1 < len(A):
				M = max(A[i + 1] + A[i], M)
		res = max(res, s + M * t)
	return res
t = inp()
for _ in range(t):
	(n, k, z) = invr()
	A = [0]
	for a in input().split():
		A.append(int(a))
	print(solve(A, k, z))


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(n, k, z) = inputnums()
	a = inputlist()
	pref = [a[0]]
	maxpair = [0, a[0] + a[1]]
	for i in range(n - 1):
		pref.append(pref[i] + a[i + 1])
		if i < n - 2:
			maxpair.append(max(maxpair[i + 1], a[i + 1] + a[i + 2]))
	ans = 0
	for i in range(min(z, k // 2) + 1):
		cur = pref[k - 2 * i] + i * maxpair[k - 2 * i + (i > 0)]
		ans = max(ans, cur)
	print(ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	pa = [0 for i in range(k + 1)]
	pa[0] = a[0]
	for i in range(1, k + 1):
		pa[i] = a[i] + pa[i - 1]
	ans = 0
	for i in range(k):
		x = k - i
		mul = min((i + 1) // 2, z)
		t = pa[k - 2 * mul] + mul * (a[x] + a[x - 1])
		ans = max(ans, t)
	print(ans)


t = int(input())
while t:
	nkz = list(map(int, input().rstrip().split()))
	n = nkz[0]
	k = nkz[1]
	z = nkz[2]
	a = list(map(int, input().rstrip().split()))
	res = 0
	for left in range(min(z + 1, k // 2 + 1)):
		ans = 0
		max_pair = 0
		for i in range(k + 1 - 2 * left):
			ans += a[i]
			if i != k:
				max_pair = max(max_pair, a[i] + a[i + 1])
		res = max(res, ans + max_pair * left)
	print(res)
	t -= 1


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	prefix = [0] * n
	prefix[0] = arr[0]
	for i in range(1, n):
		prefix[i] = prefix[i - 1] + arr[i]
	ma = 0
	for i in range(1, m + 1):
		ans = 0
		moves = m - i
		ind = i
		ans = prefix[i]
		for j in range(min(2 * k, moves)):
			if j % 2 == 0:
				ind -= 1
			else:
				ind += 1
			ans += arr[ind]
			moves -= 1
			if moves == 0:
				break
		ma = max(ans + prefix[ind + moves] - prefix[ind], ma)
	print(ma)


import sys
input = sys.stdin.readline
T = int(input())
for testcase in range(1, T + 1):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	res = 0
	ma = [0] * n
	for i in range(k + 1):
		res += a[i]
		if i > 0:
			ma[i] = max(ma[i - 1], a[i] + a[i - 1])
	s = res
	mns = 0
	for i in range(z):
		if k - i * 2 - 1 < 0:
			break
		mns += a[k - i * 2] + a[k - i * 2 - 1]
		tmp = s - mns
		tmp += (i + 1) * ma[k - i * 2 - 1]
		res = max(res, tmp)
	print(res)


import sys
readline = sys.stdin.buffer.readline

def even(n):
	return 1 if n % 2 == 0 else 0
query = int(readline())

def cumsum(lst):
	res = lst[:]
	for i in range(1, len(res)):
		res[i] += res[i - 1]
	return res
for _ in range(query):
	(n, k, z) = map(int, readline().split())
	lst1 = list(map(int, readline().split()))
	cum = cumsum(lst1)
	ans = 0
	for i in range(1, k + 1):
		moves = i
		res = cum[i]
		zs = 0
		backflag = 0
		while zs < z:
			if moves == k:
				break
			res += lst1[i - 1]
			moves += 1
			if moves == k:
				backflag = 1
				break
			res += lst1[i]
			moves += 1
			zs += 1
		if not backflag:
			res += cum[i + (k - moves)] - cum[i]
		ans = max(ans, res)
	print(ans)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split(' ')))
	si = 0
	ans = 0
	si = a[0]
	s = [0] * n
	s[0] = a[0]
	for i in range(1, n):
		s[i] = s[i - 1] + a[i]
	for i in range(1, n):
		if i > k:
			break
		si += a[i]
		res = si + a[i - 1] * min((k - i + 1) // 2, z) + a[i] * min((k - i) // 2, z)
		res += s[max(i, min(n - 1, i + k - (i + z * 2)))] - s[i]
		ans = max(ans, res)
	print(ans)


import sys
input = sys.stdin.buffer.readline

def print(val):
	sys.stdout.write(str(val) + '\n')

def prog():
	for _ in range(int(input())):
		(n, k, z) = map(int, input().split())
		a = list(map(int, input().split()))
		total = 0
		psum = [0]
		for i in range(n):
			psum.append(psum[i] + a[i])
		for i in range(k + 1):
			total += a[i]
		mx = total
		current = total
		leftover = 0
		for i in range(k, 1, -1):
			current -= a[i]
			leftover += 1
			to_left = min(z, leftover // 2)
			leftover2 = leftover - to_left * 2
			added = 0
			if leftover2 % 2 == 1:
				if to_left < z:
					added += (a[i - 1] + a[i - 2]) * to_left + max(a[i - 2], a[i])
				else:
					added += (a[i - 1] + a[i - 2]) * to_left + psum[i + leftover2] - psum[i]
				mx = max(mx, current + added)
			else:
				added += (a[i - 1] + a[i - 2]) * to_left + psum[i + leftover2] - psum[i]
				mx = max(mx, current + added)
		print(mx)
prog()


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	(n, k, z) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	maxpair = [0 for _ in range(n + 1)]
	for i in range(1, n):
		maxpair[i] = max(maxpair[i - 1], arr[i - 1] + arr[i])
	z = min(z, k // 2)
	maxTotal = 0
	for backMoves in range(z + 1):
		idx = k - 2 * backMoves + 1
		thisTotal = sum(arr[:idx]) + backMoves * maxpair[idx]
		maxTotal = max(maxTotal, thisTotal)
	print(maxTotal)


import math
t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	mx = 0
	c = 0
	for i in range(z + 1):
		c = 0
		s = 0
		for j in range(k - 2 * i + 1):
			if j + 1 <= n - 1:
				if a[j] + a[j + 1] > c:
					c = a[j] + a[j + 1]
			s += a[j]
		mx = max(mx, s + i * c)
	print(mx)


import sys
sys.setrecursionlimit(2147483647)
input = sys.stdin.readline

def calc(mani, arr):
	(n, k, z) = mani
	scores = []
	pairs = []
	for i in range(k):
		pairs.append(arr[i] + arr[i + 1])
	for i in range(0, z + 1):
		if k - 2 * i + 1 <= 0:
			continue
		max_pair = max(pairs[:k - 2 * i + 1])
		scores.append(sum(arr[:k - 2 * i + 1]) + max_pair * i)
	return max(scores)

def main():
	n = int(input())
	mani = []
	arr = []
	for _ in range(n):
		mani.append(list(map(int, input().split(' '))))
		arr.append(list(map(int, input().split(' '))))
	for i in range(n):
		print(calc(mani[i], arr[i]))
main()


(T,) = map(int, input().split())
for _ in range(T):
	(N, K, Z) = map(int, input().split())
	X = list(map(int, input().split()))
	dp = [[0] * (Z + 1) for _ in range(N + 2)]
	dp2 = [[0] * (Z + 1) for _ in range(N + 2)]
	for i in range(Z + 1):
		for j in range(1, N + 1):
			dp[j][i] = max(dp[j - 1][i], dp2[j - 1][i]) + X[j - 1]
			dp2[j][i] = dp[j + 1][i - 1] + X[j - 1]
	R = 0
	for i in range(Z + 1):
		if K - 2 * i + 1 > 0:
			R = max(R, max(dp[K - 2 * i + 1][i], dp2[K - 2 * i + 1][i]))
	print(R)


for t in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = [int(x) for x in input().split()]
	ans = 0
	maxx = 0
	sum = 0
	for i in range(z + 1):
		pos = k - 2 * i
		if pos < 0:
			continue
		maxx = 0
		sum = 0
		for j in range(pos + 1):
			if j < n - 1:
				maxx = max(maxx, a[j] + a[j + 1])
			sum += a[j]
		ans = max(ans, sum + maxx * i)
	print(ans)


import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

def solve(lst, k, z):
	console('----- solving ------')
	console(k, z)
	console('lst', lst)
	lst_rev = lst[::-1]
	arr = []
	cs = 0
	for i in lst:
		cs += i
		arr.append(cs)
	console('arr', arr)
	lst = lst[:k + 1]
	maxres = sum(lst)
	if z == 0:
		return maxres
	z = min(z, k // 2)
	for i in range(z):
		lst.pop()
		brr = [a + b for (a, b) in zip(lst, lst[1:])]
		curres = sum(lst[:-1]) + max(brr) * (i + 1)
		maxres = max(maxres, curres)
		console()
		console(i)
		console('lst', lst)
		console('brr', brr)
		console(curres)
		console()
		lst.pop()
	return maxres

def console(*args):
	return
for case_num in range(int(input())):
	(_, k, z) = list(map(int, input().split()))
	lst = list(map(int, input().split()))
	res = solve(lst, k, z)
	print(res)


from sys import *
from math import *
t = int(stdin.readline())
for _ in range(t):
	(n, k, z) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	ans = 0
	for i in range(z + 1):
		p = k - 2 * i
		if p < 0:
			continue
		mx = 0
		l = 0
		for j in range(p + 1):
			if j < n - 1:
				mx = max(mx, a[j] + a[j + 1])
			l += a[j]
		ans = max(ans, l + mx * i)
	print(ans)


import sys
import math, bisect
from collections import defaultdict
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__

def neo():
	return map(int, input().split())

def Neo():
	return list(map(int, input().split()))
for _ in range(int(input())):
	(n, k, z) = neo()
	A = Neo()
	Ans = sum(A[:k + 1])
	for i in range(1, z + 1):
		maxi = 0
		if k + 1 <= 2 * i:
			break
		for j in range(k - 2 * i + 1):
			maxi = max(maxi, A[j] + A[j + 1])
		Ans = max(Ans, sum(A[:k + 1 - i * 2]) + maxi * i)
	print(Ans)


for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	mx = 0
	for i in range(z + 1):
		h = k - i * 2
		if h < 0:
			continue
		tmp = 0
		for j in range(1, h + 1):
			two = arr[j - 1] + arr[j]
			if tmp <= two:
				tmp = two
				(f, s) = (j - 1, j)
		t1 = sum(arr[:h + 1]) + i * tmp
		if z > 0 and s == h - 1 and (i < z):
			t2 = sum(arr[:h]) + i * tmp + arr[f]
		else:
			t2 = 0
		mx = max(mx, t1, t2)
	print(mx)


testcase = int(input())
for _ in range(testcase):
	(n, k, z) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	result = 0
	for i in range(z + 1):
		a = 0
		s = 0
		for j in range(k - 2 * i + 1):
			a = a + l[j]
			if j + 1 < n:
				s = max(s, l[j] + l[j + 1])
		a = a + i * s
		result = max(result, a)
	print(result)


import sys
LI = lambda : list(map(int, sys.stdin.readline().strip('\n').split()))
MI = lambda : map(int, sys.stdin.readline().strip('\n').split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline().strip('\n'))
for _ in range(II()):
	(n, k, z) = MI()
	a = LI()
	ans = 0
	for i in range(z + 1):
		(cur, mx) = (0, 0)
		for j in range(k - 2 * i + 1):
			cur += a[j]
			if j < n - 1:
				mx = max(mx, a[j + 1] + a[j])
		ans = max(ans, cur + mx * i)
	print(ans)


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	score = sum(A[:k + 1])
	pairsMax = []
	for i in range(k):
		if i == 0:
			pairsMax.append(A[i] + A[i + 1])
		else:
			pairsMax.append(max(A[i] + A[i + 1], pairsMax[-1]))
	scoreBase = score
	for j in range(k, -1, -2):
		if (k - j) // 2 > z:
			break
		if j < k:
			scoreBase -= A[j + 2] + A[j + 1]
			score = max(score, scoreBase + pairsMax[j + 1] * ((k - j) // 2))
	print(score)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class union_find:

	def __init__(self, n):
		self.n = n
		self.rank = [0] * n
		self.parent = [int(j) for j in range(n)]

	def union(self, i, j):
		i = self.find(i)
		j = self.find(j)
		if self.rank[i] == self.rank[j]:
			self.parent[i] = j
			self.rank[j] += 1
		elif self.rank[i] > self.rank[j]:
			self.parent[j] = i
		else:
			self.parent[i] = j

	def find(self, i):
		temp = i
		if self.parent[temp] != temp:
			self.parent[temp] = self.find(self.parent[temp])
		return self.parent[temp]
from math import log2, ceil

def main():
	for t in range(int(input())):
		(n, k, z) = [int(j) for j in input().split()]
		l = [int(j) for j in input().split()]
		mx = [-1] * n
		pre = [l[0]] * n
		for i in range(1, min(k + 1, n)):
			pre[i] = pre[i - 1] + l[i]
			mx[i] = max(mx[i - 1], l[i] + l[i - 1])
		ans = 0
		for i in range(k, -1, -2):
			rev = (k - i) // 2
			if rev > z:
				break
			tm = mx[i]
			if i + 1 < n:
				tm = max(mx[i], mx[i + 1])
			tmp = pre[i] + rev * tm
			ans = max(tmp, ans)
		print(ans)
main()


from math import ceil
t = int(input())
for i in range(t):
	(n, k, z) = [int(x) for x in input().strip().split()]
	a = [int(x) for x in input().strip().split()]
	pref = []
	s = 0
	for e in a:
		s += e
		pref.append(s)
	mxloop = []
	mx = -1
	for i in range(n - 1):
		s = a[i] + a[i + 1]
		if s > mx:
			mx = s
			idx = i + 1
		mxloop.append((mx, idx))
	res = pref[k]
	for i in range(1, z + 1):
		if k - 2 * i >= 0:
			(mx, idx) = mxloop[k - 2 * i]
			curr = pref[k - 2 * i] + i * mx
			res = max(res, curr)
	print(res)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(n, k, z) = list(map(int, input().split()))
		arr = list(map(int, input().split()))
		if z == 0:
			yield sum(arr[:k + 1])
		else:
			plainsum = sum(arr[:k + 1])
			maxsum = plainsum
			for i in range(1, k + 1):
				maxtemp = plainsum
				tempsum = plainsum
				curepeat = arr[i] + arr[i - 1]
				end = k
				times = z
				while end > i and times > 0:
					if end - i >= 2:
						tominus = arr[end] + arr[end - 1]
						tempsum += curepeat - tominus
						end -= 2
						maxtemp = max(maxtemp, tempsum)
						times -= 1
					else:
						inamo = arr[i - 1] - arr[end]
						tempsum += inamo
						end -= 1
						maxtemp = max(maxtemp, tempsum)
						times -= 1
				maxsum = max(maxsum, maxtemp)
			yield maxsum
t = int(input())
ans = gift()
print(*ans, sep='\n')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(n, k, z) = sp()
	arr = l()
	answer = 0
	for i in range(z + 1):
		steps = k - 2 * i
		if steps < 0:
			continue
		(t1, t2) = (0, 0)
		for j in range(steps + 1):
			if j < n - 1:
				t1 = max(t1, arr[j] + arr[j + 1])
			t2 += arr[j]
		answer = max(answer, t2 + t1 * i)
	out(answer)


from collections import Counter
import math
import sys
from bisect import bisect, bisect_left, bisect_right

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def mod():
	return 10 ** 9 + 7
for i in range(INT()):
	(n, k, z) = MAP()
	a = LIST()
	if k == 1:
		if k == 1:
			print(a[0] + a[1])
		continue
	pre = []
	maxv = []
	pre.append(a[0])
	for i in range(1, n):
		pre.append(a[i] + pre[i - 1])
	mn = -1
	a.append(10 ** 10)
	for i in range(1, n):
		val = a[i] + a[i + 1]
		if mn < val:
			maxv.append([a[i], a[i - 1]])
		else:
			maxv.append([maxv[i - 1][0], maxv[i - 1][1]])
	ans = 0
	for i in range(1, k):
		step = k - i
		val = pre[k] - pre[i]
		if k - i >= 2 * z:
			y = z
			x = z
			r = k - 2 * z
		else:
			y = (k - i) // 2
			x = k - i - y
			r = i
		temp1 = maxv[i - 1][1] * x
		temp2 = maxv[i - 1][0] * y
		aaa = temp2 + temp1 + pre[r] - pre[i]
		nag = max(val, aaa)
		ans = max(ans, nag + pre[i])
	print(ans)


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def min_subs(n, binary):
	(a, b) = (1, 1)
	mx = 0
	prev = not int(binary[0])
	res = [0] * n
	for i in range(n):
		if int(binary[i]) == 1:
			if int(binary[i]) == prev:
				a += 1
				b = a
			res[i] = a
		else:
			if int(binary[i]) == prev:
				b += 1
				a = b
			res[i] = b
		prev = int(binary[i])
		mx = max(mx, max(a, b))
	print(mx)
	print(*res, sep=' ')

def steps(n):
	return n // 2 + 1

def find_order(n):
	if n % 2 == 0:
		print(*[x for x in range(n, 0, -1)], sep=' ')
	else:
		print(-1)

def max_find(n, k, z, a):
	res = 0
	s = 0
	mx = 0
	for t in range(z + 1):
		pos = k - 2 * t
		if pos < 0:
			continue
		mx = 0
		s = 0
		for i in range(pos + 1):
			if i < n - 1:
				mx = max(mx, a[i] + a[i + 1])
			s += a[i]
		res = max(res, s + mx * t)
	return res
t = 1
t = int(input())
while t:
	t = t - 1
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().strip().split()))[:n]
	print(max_find(n, k, z, a))


import sys
input = sys.stdin.readline
from collections import *
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for l in range(z + 1):
		pos = k - 2 * l
		if pos < 0:
			continue
		cand = 0
		m = 0
		for i in range(pos + 1):
			cand += a[i]
			if i + 1 < n:
				m = max(m, a[i] + a[i + 1])
		cand += m * l
		ans = max(ans, cand)
	print(ans)


import sys
input = sys.stdin.buffer.readline

def solution():
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = -1
	m = -1
	s = 0
	for p in range(z + 1):
		pos = k - 2 * p
		if pos < 0:
			continue
		m = -1
		s = 0
		for i in range(pos + 1):
			if i < n - 1:
				m = max(m, l[i] + l[i + 1])
			s += l[i]
		ans = max(ans, s + p * m)
	print(ans)
t = int(input())
for _ in range(t):
	solution()


T = int(input())
for _ in range(0, T):
	(n, k, z) = map(int, input().split())
	s = [int(x) for x in input().split()]
	c = []
	for i in range(0, z + 1):
		if k - 2 * i >= 0:
			ct = s[0]
			for j in range(1, k - 2 * i + 1):
				ct += s[j]
			mx = 0
			for j in range(0, min(n - 1, k - 2 * i + 1)):
				mx = max(mx, s[j] + s[j + 1])
			ct += i * mx
			c.append(ct)
	print(max(c))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, k, m):
	res = 1
	while k > 0:
		if k % 2 == 1:
			res = res * a % m
		a = a * a % m
		k = k // 2
	return res % m

def solution():
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	sumy = arr[0]
	for i in range(1, k):
		sumy += arr[i]
	dp = [0 for i in range(n + 1)]
	prefix = [0] * (n + 1)
	prefix[0] = arr[0]
	for i in range(1, n):
		prefix[i] = prefix[i - 1] + arr[i]
	for i in range(1, k + 1):
		dp[i] = prefix[i]
		temp = z
		flag = True
		su = 0
		totm = k - i
		while temp > 0 and totm > 0:
			if flag:
				su += arr[i - 1]
				temp -= 1
				totm -= 1
			else:
				su += arr[i]
				totm -= 1
			flag = not flag
		rem = k - (i + z)
		dp[i] += su
		ind = i if z > 0 else i + 1
		dp[i] += prefix[ind + totm - 1] - prefix[ind - 1]
	print(max(dp))
for i in range(int(input())):
	solution()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	(n, k, z) = sep()
	a = lis()
	pre = [0] * (n + 1)
	for i in range(n):
		pre[i] += pre[i - 1] + a[i]
	help = [0] * (n + 1)
	help[1] = a[0] + a[1]
	for i in range(2, n):
		if a[i] + a[i - 1] > help[i - 1]:
			help[i] = a[i] + a[i - 1]
		else:
			help[i] = help[i - 1]
	ans = 0
	for i in range(k, 0, -1):
		cnt = k - i
		if cnt > 2 * z:
			break
		if cnt % 2 == 0:
			ans = max(ans, help[i] * (cnt // 2) + pre[i])
		elif cnt < 2 * z:
			ans = max(ans, help[i] * (cnt // 2) + pre[i] + a[i - 1])
	print(ans)
testcase(int(inp()))


t = int(input())
while t:
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	psum = [0] * n
	total = [a[0]] * n
	score = 0
	mx = 0
	for i in range(0, n - 1):
		psum[i] = max(psum[i - 1], a[i] + a[i + 1])
	for i in range(1, n):
		total[i] = total[i - 1] + a[i]
	while z >= 0:
		if k - 2 * z < 0:
			z -= 1
			continue
		score = max(score, total[k - 2 * z] + z * psum[k - 2 * z])
		z -= 1
	print(score)
	t -= 1


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	dp = [0 for i in range(k + 1)]
	dp[0] = l[0]
	for i in range(1, k + 1):
		dp[i] = l[i] + dp[i - 1]
	ans = dp[k]
	for i in range(k - 1):
		r = k - i
		r1 = r // 2
		p = r % 2
		if r1 >= z:
			r = r - 2 * z
			ans = max(ans, dp[i + r] + (l[i] + l[i + 1]) * z)
		else:
			ans = max(ans, dp[i] + (l[i] + l[i + 1]) * (r // 2) + l[i + 1] * p)
	print(ans)


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split())) + [0]
	s = list(a)
	for i in range(n - 1):
		s[i + 1] += s[i]
	mx = 0
	arr = [0] * n
	for i in range(n):
		mx = max(mx, a[i] + a[i + 1])
		arr[i] = mx
	ans = 0
	for i in range(0, min(2 * z, k) + 1, 2):
		rem = k - i
		x = s[rem] + i // 2 * arr[rem]
		ans = max(ans, x)
	print(ans)


import sys
input = sys.stdin.readline
from collections import defaultdict

def main():
	(n, k, z) = map(int, input().split())
	alst = list(map(int, input().split()))
	rui = [alst[0]]
	for a in alst[1:]:
		rui.append(rui[-1] + a)
	adj = []
	max_adj = 0
	for i in range(n - 1):
		tmp = alst[i] + alst[i + 1]
		max_adj = max(max_adj, tmp)
		adj.append(max_adj)
	adj.append(0)
	ans = 0
	for i in range(z + 1):
		if k - i * 2 < 0:
			break
		tmp = rui[k - i * 2] + i * adj[k - i * 2]
		ans = max(ans, tmp)
	print(ans)
for _ in range(int(input())):
	main()


import math

def main():
	for _ in range(int(input())):
		(n, k, z) = list(map(int, input().split()))
		a = list(map(int, input().split()))
		best = [[-math.inf for _ in range(z + 1)] for _ in range(n)]
		best[0][0] = a[0]
		for i in range(n):
			for j in range(z + 1):
				if j == 0:
					if i == 0:
						pass
					else:
						best[i][j] = best[i - 1][j] + a[i]
				else:
					if i == n - 1:
						best[i][j] = -math.inf
					else:
						best[i][j] = best[i][j - 1] + a[i] + a[i + 1]
					if i != 0:
						best[i][j] = max(best[i][j], best[i - 1][j] + a[i])
		print(max([best[k - 2 * j][j] for j in range(z + 1) if k >= 2 * j]))
main()


import math

def get_sums(l):
	x = [0, l[0]]
	for i in range(1, len(l)):
		x.append(x[-1] + l[i])
	return x

def get_sum_srez(l, left, right):
	return l[right + 1] - l[left]
t = int(input())
for _ in range(t):
	(n, k, z) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	max_val = 0
	counts = []
	sums = get_sums(l)
	for t in range(k):
		touch_t_count = min(math.ceil((k - (t + 1)) / 2), z)
		ost = k - (t + 1) - touch_t_count - (touch_t_count - 1)
		val = get_sum_srez(sums, 0, t + 1) + touch_t_count * l[t] + (touch_t_count - 1) * l[t + 1] + get_sum_srez(sums, t + 1, t + ost)
		max_val = max(val, max_val)
	print(max_val)


t = int(input().split()[0])
for case in range(t):
	(n, k, z) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = 0
	for i in range(k + 1):
		ans += arr[i]
	if z == 0:
		print(ans)
		continue
	bestGain = 0
	for i in range(k):
		currGain = 0
		if i + 2 * z <= k:
			currGain = z * (arr[i] + arr[i + 1]) - sum(arr[k + 1 - 2 * z:k + 1])
		else:
			movesLeft = k - 1 - i
			first = True
			while movesLeft > 0:
				if first:
					currGain += arr[i] - arr[k - movesLeft + 1]
				else:
					currGain += arr[i + 1] - arr[k - movesLeft + 1]
				first = not first
				movesLeft -= 1
		if currGain > bestGain:
			bestGain = currGain
	print(ans + bestGain)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
from itertools import permutations
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	pre = [0] * (n + 1)
	ans = 0
	for i in range(1, k + 1):
		ans += a[i]
		if i == 1:
			pre[i] = a[i]
		else:
			pre[i] = pre[i - 1] + a[i]
	for i in range(n - 1):
		l1 = k - i
		e = min(l1 // 2, z)
		ans1 = pre[i] + e * (a[i] + a[i + 1])
		l1 -= 2 * e
		if l1 > 0:
			ans1 += pre[i + l1] - pre[i]
		ans = max(ans, ans1)
	print(ans + a[0])


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	su = l[0]
	k -= 1
	pre = [0]
	mx = l[0]
	for i in range(n):
		pre.append(pre[-1] + l[i])
	for i in range(1, n):
		su = pre[i + 1]
		mi = min(2 * z, k)
		if mi % 2:
			left = k - mi
			ii = min(n, i + left)
			su += (mi // 2 + 1) * l[i - 1] + mi // 2 * l[i] + pre[ii] - pre[i]
		else:
			left = k - mi
			ii = min(n, i + left + 1)
			su += mi // 2 * (l[i] + l[i - 1]) + pre[ii] - pre[i + 1]
		mx = max(mx, su)
		if k == 0:
			break
		k -= 1
	print(mx)
	t -= 1


from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
	(n, k, z) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	dp = [[0, 0] for i in range(n)]
	ans = 0
	for i in range(n):
		if i == 0:
			dp[i][0] = a[0]
			continue
		dp[i][0] = dp[i - 1][0] + a[i]
		if i == k:
			ans = max(ans, dp[i][0])
		dp[i][1] = dp[i - 1][1] + a[i]
		if i + 2 * z == k:
			ans = max(ans, dp[i][1])
		tmp = dp[i][0]
		nn = 0
		for t in range(z):
			tmp += a[i - 1]
			nn += 1
			if i + nn == k:
				ans = max(ans, tmp)
			tmp += a[i]
			nn += 1
			if i + nn == k:
				ans = max(ans, tmp)
		dp[i][1] = max(dp[i][1], tmp)
	print(ans)


T = int(input())

def solve():
	maxleft = min(k // 2, z)
	val = 0
	for i in range(maxleft + 1):
		temp = sum(a[:k + 1 - 2 * i])
		temp += i * max(apair[:k + 1 - 2 * i])
		val = max(val, temp)
	return val
for test in range(T):
	(n, k, z) = map(int, input().split())
	a = [int(x) for x in input().split()]
	apair = [a[i] + a[i + 1] for i in range(n - 1)]
	print(solve())


from collections import defaultdict as dd
import math
import sys
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
q = nn()
for _ in range(q):
	(n, k, z) = mi()
	nums = lm()
	m = 0
	for i in range(min(z + 1, k // 2 + 1)):
		oneverse = sum(nums[:k - 2 * i + 1])
		mpair = 0
		if i > 0:
			for j in range(k - 2 * i + 1):
				mpair = max(mpair, nums[j] + nums[j + 1])
		m = max(m, oneverse + i * mpair)
	print(m)


for q in range(int(input())):
	INF = 10 ** 20
	(n, k, z) = map(int, input().split())
	line = list(map(int, input().split()))
	dp = [[INF] * (z + 1) for i in range(k + 2)]
	dp[0][0] = line[0]
	ans = line[0]
	for i in range(1, k + 1):
		for j in range(z + 1):
			if i + 2 * j <= k:
				if dp[i - 1][j] != INF:
					dp[i][j] = dp[i - 1][j] + line[i]
				if j != 0:
					var1 = -1 if dp[i][j] == INF else dp[i][j]
					var2 = -1 if dp[i - 1][j - 1] == INF else dp[i - 1][j - 1] + line[i - 1] + line[i] * 2
					var3 = dp[i][j - 1] + line[i - 1] + line[i]
					dp[i][j] = max(var1, var2, var3)
				if dp[i][j] != INF:
					ans = max(ans, dp[i][j])
			if i + 2 * j + 1 <= k and j < z:
				ans = max(ans, dp[i][j] + line[i - 1])
	print(ans)


import math
T = int(input())
for i in range(T):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	d = False
	dp = [[0] * (z + 1) for i in range(n)]
	dp[0][0] = a[0]
	for i in range(1, n):
		dp[i][0] = dp[i - 1][0] + a[i]
		for j in range(1, z + 1):
			dp[i][j] = max(dp[i - 1][j] + a[i], dp[i][j - 1] + a[i] + a[i - 1])
	ans = dp[k][0]
	if z > 0 and k >= 3:
		ans = max(ans, dp[k - 2][1])
	if z > 0 and k >= 2:
		ans = max(ans, dp[k - 1][0] + a[k - 2])
	if z > 1 and k >= 5:
		ans = max(ans, dp[k - 4][2])
	if z > 0 and k >= 2:
		ans = max(ans, dp[k - 1][0] + a[k - 2])
	if z > 2 and k >= 7:
		ans = max(ans, dp[k - 6][3])
	if z > 1 and k >= 4:
		ans = max(ans, dp[k - 3][1] + a[k - 4])
	if z > 3 and k >= 9:
		ans = max(ans, dp[k - 8][4])
	if z > 2 and k >= 6:
		ans = max(ans, dp[k - 5][2] + a[k - 6])
	if z > 4 and k >= 11:
		ans = max(ans, dp[k - 10][5])
	if z > 3 and k >= 8:
		ans = max(ans, dp[k - 7][3] + a[k - 8])
	if z > 4 and k >= 10:
		ans = max(ans, dp[k - 9][4] + a[k - 10])
	print(ans)


def task1(arr, k, z):
	maxsum = 0
	for lmoves in range(z + 1):
		rmoves = k - 2 * lmoves
		sum_rmoves = sum(arr[:rmoves + 1])
		for lrpos in range(rmoves + 1):
			if lrpos < len(arr) - 1:
				tempsum = lmoves * (arr[lrpos] + arr[lrpos + 1]) + sum_rmoves
				maxsum = tempsum if tempsum > maxsum else maxsum
	return maxsum
t = int(input())
results = []
for i in range(t):
	[n, k, z] = input().split()
	arr = input().split()
	arr = [int(arr[i]) for i in range(len(arr))]
	results.append(task1(arr, int(k), int(z)))
for i in range(t):
	print(results[i])


inp = lambda : map(int, input().split(' '))
(t,) = inp()
for _ in range(t):
	(n, k, z) = inp()
	a = list(inp())
	max_index = 0
	max_pair = 0
	max_sum = 0
	lin_sum = a[0]
	for i in range(k):
		curr_pair = a[i] + a[i + 1]
		max_pair = max(max_pair, curr_pair)
		lin_sum += a[i + 1]
		rem_steps = k - (i + 1)
		backs = min(z, rem_steps // 2)
		if rem_steps - 2 * backs != 0 and backs == z:
			continue
		curr_sum = lin_sum + backs * max_pair
		curr_sum += 0 if rem_steps - 2 * backs == 0 else a[i]
		max_sum = max(curr_sum, max_sum)
	print(max_sum)


import sys
from math import floor, ceil
INP = lambda : sys.stdin.readline().strip()
INT = lambda : int(INP())
MAP = lambda : map(int, INP().split())
ARR = lambda : [int(i) for i in INP().split()]

def JOIN(arr, x=' '):
	return x.join([str(i) for i in arr])

def EXIT(x='NO'):
	print(x)
	exit()

def solve():
	(n, k, z) = MAP()
	arr = ARR()
	ans = arr[0]
	s = arr[0]
	sums = [0, arr[0]]
	for i in range(1, n):
		sums.append(sums[-1] + arr[i])
	for i in range(1, min(k + 1, n)):
		s += arr[i]
		k -= 1
		if 2 * z < k:
			score = s + z * (arr[i - 1] + arr[i]) + sums[min(i + 1 + k - 2 * z, n)] - sums[i + 1]
			ans = max(ans, score)
		else:
			c = k / 2
			score = s + ceil(c) * arr[i - 1] + floor(c) * arr[i]
			ans = max(ans, score)
	return ans
for _ in range(INT()):
	print(solve())


from sys import stdin
t = int(stdin.readline().strip())
for _ in range(t):
	(n, k, z) = list(map(int, stdin.readline().strip().split(' ')))
	A = list(map(int, stdin.readline().strip().split(' ')))
	max_score = sum(A[0:k + 1])
	for z_val in range(1, z + 1):
		if k + 1 - 2 * z_val < 1:
			continue
		subarray = A[0:k + 1 - 2 * z_val]
		score = sum(subarray)
		maxPair = max([A[i] + A[i + 1] for i in range(k + 1 - 2 * z_val)])
		score += maxPair * z_val
		max_score = max(score, max_score)
	print(max_score)


def solve():
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	dp = [[0] * 6 for _ in range(n + 1)]
	dp[0][0] = a[0]
	for i in range(1, n):
		for j in range(0, z + 1):
			dp[i][j] = dp[i - 1][j] + a[i]
		for j in range(1, z + 1):
			dp[i][j] = max(dp[i][j], dp[i][j - 1] + a[i] + a[i - 1])
	ans = 0
	for i in range(0, z + 1):
		if k - i * 2 >= 0:
			ans = max(ans, dp[k - i * 2][i])
		if k - i * 2 - 1 > 0 and i + 1 <= z:
			ans = max(ans, dp[k - i * 2 - 1][i] + a[k - i * 2 - 2])
	print(ans)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	l = list(map(int, input().split()))
	m_score = sum(l[:k + 1])
	if z >= 1:
		s = 0
		for i in range(k - 2):
			if i >= 0:
				s = max(s, l[i] + l[i + 1])
		if k >= 2:
			m_score = max(m_score, sum(l[:k - 1]) + s)
			s = max(l[k - 2] + l[k - 1], s)
			m_score = max(m_score, sum(l[:k]) + l[k - 2])
	if z >= 2:
		s = 0
		for i in range(k - 4):
			if i >= 0:
				s = max(s, l[i] + l[i + 1])
		if k >= 4:
			m_score = max(m_score, sum(l[:k - 3]) + 2 * s)
			s = max(l[k - 4] + l[k - 3], s)
			m_score = max(m_score, sum(l[:k - 2]) + s + l[k - 4])
	if z >= 3:
		s = 0
		for i in range(k - 6):
			if i >= 0:
				s = max(s, l[i] + l[i + 1])
		if k >= 6:
			m_score = max(m_score, sum(l[:k - 5]) + 3 * s)
			s = max(l[k - 6] + l[k - 5], s)
			m_score = max(m_score, sum(l[:k - 4]) + 2 * s + l[k - 6])
	if z >= 4:
		s = 0
		for i in range(k - 8):
			if i >= 0:
				s = max(s, l[i] + l[i + 1])
		if k >= 8:
			m_score = max(m_score, sum(l[:k - 7]) + 4 * s)
			s = max(l[k - 8] + l[k - 7], s)
			m_score = max(m_score, sum(l[:k - 6]) + 3 * s + l[k - 8])
	if z >= 5:
		s = 0
		for i in range(k - 10):
			if i >= 0:
				s = max(s, l[i] + l[i + 1])
		if k >= 10:
			m_score = max(m_score, sum(l[:k - 9]) + 5 * s)
			s = max(l[k - 10] + l[k - 9], s)
			m_score = max(m_score, sum(l[:k - 8]) + 4 * s + l[k - 10])
	print(m_score)


import io
import os

def main():
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
	for t in range(int(input())):
		(n, k, z) = map(int, input().split())
		a = list(map(int, input().split()))
		b = [0]
		for i in range(n):
			b.append(b[-1] + a[i])
		ma = 0
		if z != 0:
			for i in range(1, k + 1):
				if k - i >= 2 * z - 1:
					ma = max(ma, b[i + 1] + a[i - 1] * z + (z * a[i] + b[k - 2 * z + 1] - b[i + 1] if k - i >= 2 * z else (z - 1) * a[i]))
				else:
					ma = max(ma, b[i + 1] + a[i] * ((k - i) // 2) + a[i - 1] * ((k - i) // 2 + (k - i) % 2))
		else:
			ma = b[k + 1]
		print(ma)
main()


import io
import os

def main():
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
	for _ in range(int(input())):
		(n, k, z) = map(int, input().split())
		arr = list(map(int, input().split()))
		su = [0]
		for i in arr:
			su.append(su[-1] + i)
		fin = su[k + 1]
		for i in range(1, k):
			ans = su[i + 1]
			(K, Z) = (k - i, z)
			for _ in range(min(K // 2, z)):
				ans += arr[i - 1] + arr[i]
			Z -= min(K // 2, z)
			K -= min(K // 2, z) * 2
			if not K:
				fin = max(ans, fin)
			elif Z:
				fin = max(ans + arr[i - 1], ans + arr[i + 1], fin)
			else:
				fin = max(fin, ans + su[i + K + 1] - su[i + 1])
		print(fin)
main()


t = int(input())
for _ in range(t):
	(n, k, z) = map(int, input().split())
	A = list(map(int, input().split()))
	A = A[:k + 1]
	preSum = []
	sum = 0
	for i in range(len(A)):
		sum += A[i]
		preSum.append(sum)
	ans = -1
	for i in range(1, len(A)):
		c = preSum[i]
		if 2 * z <= k - i:
			c += (A[i] + A[i - 1]) * z
			c += preSum[i + (k - i) - 2 * z] - preSum[i]
			ans = max(c, ans)
		elif (k - i) % 2 == 0:
			c += (A[i] + A[i - 1]) * ((k - i) // 2)
			ans = max(c, ans)
		else:
			c += (A[i] + A[i - 1]) * ((k - i) // 2) + A[i - 1]
			ans = max(c, ans)
	print(ans)


t = int(input())
for i in range(t):
	(n, k, z) = map(int, input().split())
	a = list(map(int, input().split()))
	j = 0
	pre = [0]
	while j < n:
		pre.append(pre[-1] + a[j])
		j += 1
	j = 1
	ans = a[0]
	while j < n:
		curr = k - j
		if curr == 0:
			ans = max(ans, pre[j + 1])
			break
		if curr > 2 * z:
			ans = max(ans, pre[j + 1 + curr - 2 * z] + (a[j] + a[j - 1]) * z)
		elif curr % 2 == 0:
			ans = max(ans, pre[j + 1] + (a[j] + a[j - 1]) * (curr // 2))
		else:
			ans = max(ans, pre[j + 1] + (a[j] + a[j - 1]) * (curr // 2) + a[j - 1])
			if j != n - 1:
				ans = max(ans, pre[j + 1] + (a[j] + a[j - 1]) * (curr // 2) + a[j + 1])
		j += 1
	print(ans)


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		(n, k, z) = map(int, input().split())
		ar = inpt()
		pre = [0]
		for i in range(n):
			pre.append(ar[i])
			pre[i + 1] += pre[i]
		mx = 0
		sm = ar[0]
		for i in range(1, n):
			sm += ar[i]
			k -= 1
			mx = max(mx, sm)
			if k == 0:
				break
			d = k // 2
			r = k % 2
			left = d + r
			if left <= z:
				temp = ar[i - 1] * left
				temp += ar[i] * d
				temp += sm
				mx = max(mx, temp)
			elif z < left:
				temp = ar[i - 1] * z
				temp += ar[i] * z
				f = k - 2 * z
				temp += sm
				temp += pre[i + f + 1] - pre[i + 1]
				mx = max(mx, temp)
		print(mx)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	(n, k, z) = map(int, stdin.readline().split())
	a_a = list(map(int, stdin.readline().split()))
	preSum = [0]
	for i in range(len(a_a)):
		preSum.append(a_a[i] + preSum[i])
	ans = a_a[0]
	for i in range(1, len(a_a)):
		move = k
		score = preSum[i + 1]
		move -= i
		if move == 0:
			ans = max(ans, score)
			break
		if move < 2 * z:
			score += a_a[i] * (move // 2)
			score += a_a[i - 1] * (move // 2 + move % 2)
		else:
			score += (a_a[i] + a_a[i - 1]) * z
			move -= 2 * z
			score += preSum[min(i + move + 1, len(a_a))] - preSum[i + 1]
		ans = max(ans, score)
	stdout.write(str(ans) + '\n')


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(n, k, z) = iia()
	arr = iia()
	pre = arr[:]
	for i in range(1, len(pre)):
		pre[i] += pre[i - 1]
	res = pre[k]
	for i in range(1, k + 1):
		(t1, t2, t3) = (z, k - i, pre[i])
		while t1 > 0 and t2 > 1:
			t3 += arr[i] + arr[i - 1]
			t1 -= 1
			t2 -= 2
		if t1 > 0 and t2 == 1:
			if i + 1 < len(arr):
				t3 += max(arr[i - 1], arr[i + 1])
			else:
				t3 += arr[i - 1]
		else:
			t3 += pre[i + t2] - pre[i]
		res = max(res, t3)
	print(res)


t = int(input())
for _ in range(0, t):
	(n, k, z) = map(int, input().strip().split(' '))
	arr = list(map(int, input().strip().split(' ')))
	ans = 0
	maxx = 0
	for i in range(0, z + 1):
		pos = k - 2 * i + 1
		if pos < 0:
			continue
		maxx = 0
		temp = 0
		for j in range(0, pos):
			if j < n - 1:
				maxx = max(maxx, arr[j] + arr[j + 1])
			temp += arr[j]
		ans = max(ans, temp + maxx * i)
	print(ans)