#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k, x;
    cin >> n >> k >> x;
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<long long> ps(n + 1);
    ps[0] = 0;
    for (int i = 1; i < n+1; i++)
    {
        ps[i] += ps[i - 1] + a[i-1];
    }
    if (x == 2) {
        vector<long long> res(n-k+1);
        for (int i = 1; i <= n - k + 1; i++)
        {
            int m = 0;
            for (int j = i+1; j <= k + i; j++)
            {
                int suma2 = ps[k + i - 1] - ps[j - 1];
                int suma1 = ps[j - 1] - ps[i - 1];
                m = max(2 * suma2 + suma1, m);
            }
            res[i-1] = m;
        }
        for (int i = 0; i < n-k+1; i++)
        {
            cout << res[i] << endl;
        }
    }
}