from collections import deque N, B, C = map(int, input().split()) A = list(map(int, input().split())) t = 0 k = 0 d = deque() e = deque() for i, a in enumerate(A): if d: u = e[0][0] + k else: u = -(10**18) if B > 2 or i == 0: u = max(u, t) d.append((t - k, i)) e.append((t - k, i)) while len(e) >= 2 and e[-2] < e[-1]: x = e.pop() e.pop() e.append(x) k += a while len(d) >= C: x = d.popleft() if len(e) > 0 and e[0] == x: e.popleft() t = u print(max(t, max(d)[0] + k))