#include <bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
//typedef long long int lint;

int vrati(vector<int> a, int x){
    if(x <= 0){
        return 0;
    }
    int n = a.size();
    vector<int> as = a;
    sort(as.begin(), as.end());
    reverse(as.begin(), as.end());
    map<int, int> mapa;
    for(int i = 0; i < x; i++){
        mapa[as[i]]++;
    }
    int c = 1;
    int rez = 0;
    for(int i = 0; i < n; i++){
        if(mapa[a[i]] > 0){
            rez += (c * a[i]);
            mapa[a[i]]--;
        }
    }
    return rez;
}

void solve(){
    int n, k, x;
    cin >> n >> k >> x;
    vector<int> a(n);
    bool sviveciod0 = true;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] < 0){
            sviveciod0 = false;
        }
    }

    if(sviveciod0){
        int prvirez = 0;
        vector<int> b;
        for(int ink = 0; ink < k; ink++){
            b.push_back(a[ink]);
        }
        int ssvih = 0;
        for(int j = 0; j < k; j++){
            prvirez += b[j];
            ssvih += b[j];
        }
        reverse(b.begin(), b.end());
        vector<int> c(k - 1);
        int trs = 0;
        for(int j = 0; j < (k - 1); j++){
            c[j] = trs + b[j];
            trs += b[j];
        }
        reverse(c.begin(), c.end());
        reverse(b.begin(), b.end());
        prvirez += vrati(c, (x - 1));

        cout << prvirez << " ";
        int sprvihx = 0;
        for(int i = 0; i < (x - 1); i++){
            sprvihx += (a[i]);
        }

        int rez = prvirez;

    //sada treba da sredim ostalih k-1 clanova

        for(int i = 0; i < (n - k + 1 - 1); i++){
            //cout << a[2] << endl;
            int sprvihxprim = sprvihx - (a[i]) + a[i + x - 1];
            int ssvihprim = ssvih - a[i] + a[i + k];
            rez = rez + (ssvihprim - ssvih) - sprvihxprim + ((x - 1) * a[i + k]);
            sprvihx = sprvihxprim;
            ssvih = ssvihprim;
            cout << rez << " ";
        }

        return;
    }

    for(int i = 0; i <= (n - k); i++){
        vector<int> b;
        for(int ink = 0; ink < k; ink++){
            b.push_back(a[i + ink]);
        }
        int rez = 0;
        for(int j = 0; j < k; j++){
            rez += b[j];
        }
        reverse(b.begin(), b.end());
        vector<int> c(k - 1);
        int trs = 0;
        for(int j = 0; j < (k - 1); j++){
            c[j] = trs + b[j];
            trs += b[j];
        }
        reverse(c.begin(), c.end());

/*
        for(int i = 0; i < c.size(); i++){
            cout << c[i] << " ";
        }
        cout << endl;
*/

        rez += max(vrati(c, (x - 1)), vrati(c, (x - 2)));
        cout << rez << " ";
    }
    cout << endl;
}


signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}