import java.util.*; public class Main { static int m; static int[] arr; static long[][] dp; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); m = sc.nextInt(); arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } dp = new long[n][k]; System.out.println(dfw(n - 1, k - 1)); } static long dfw(int idx, int block) { if (idx < 0 && block < 0) { return 0; } if (block < 0) { return Long.MIN_VALUE; } if (dp[idx][block] != 0) { return dp[idx][block]; } long max = 0; long sum = 0; for (int i = 0; i < m && i <= idx - block; i++) { sum += arr[idx - i]; max = Math.max(max, Math.abs(sum) + dfw(idx - 1 - i, block - 1)); } dp[idx][block] = max; return max; } }