#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k, x;
    cin >> n >> k >> x;
    vector<int> v;

    for(int i = 0; i < n; i++){
        int pom;
        cin >> pom;
        v.push_back(pom);
    }
    int dp[200100];
    int dp2[200100];
    dp2[0] = v[0];
    dp[n-1] = v[n-1];
    for(int i = n-2; i >= 0; i--)
        dp[i] = dp[i+1] + v[i];
    for(int i = 1; i< n; i++)
        dp2[i] = dp2[i-1] + v[i];
    cout << endl;
    for(int i = 0; i < n-x; i++){
        int ans =0;
        pair<int, int> par;
        par.first = n-1;
        par.second = 0;
        vector<pair<int,int>> pom;
        pom.push_back(par);
        for(int j = i; j < i+k; j++){
            pair<int, int> pompar;
            pompar.first = j;
            pompar.second = dp[j] - dp[i+k+1];
            pom.push_back(pompar);
        }
        sort(pom.begin(), pom.end(), [](auto &g, auto &f) {
        return g.second > f.second;
        });
        for(auto a:pom){
            cout << a.first << " " << a.second << " ";
        }
        cout << endl;
        vector<pair<int, int>> vektor;
        for(int j = 0; j < x; j++)
            vektor.push_back(pom[i]);
        for(int j = 1; j < x; j++)
            ans += (pom[j].second-pom[j-1].second)*(x-j);
        sort(vektor.begin(), vektor.end(), [](const auto &g, const auto &f) {
            return g.first < f.first;
        });
        ans += dp2[vektor[0].first];
        cout << ans << endl;
    }
    return 0;
}