N,K,M = map(int, input().split()) A = [int(a) for a in input().split()] S = [0]*(N+1) for i in range(N): S[i+1] = S[i]+abs(A[i]) S2 = [0]*(N+1) for i in range(N): S2[i+1] = S2[i]+A[i] memo = {} def f(l, r, n): if N-r-1 < n or n*M < N-r-1: return 0 if (l, r, n) in memo: return memo[(l, r, n)] res = abs(S2[r+1]-S2[l]) temp = 0 for i in range(r+1, min(r+1+M, N)): temp = max(temp, f(r+1, i, n-1)) memo[(l, r, n)] = res+temp return res+temp ans = 0 for r in range(M): ans = max(ans, f(0, r, K-1)) print(ans)