#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define endl "\n"
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);

struct segtree{
    int size;
    vector<ll>seg;

    void init(int n){
        size=1;
        while(size<n)size*=2;
        seg.assign(2*size,(ll)-1e18);
    }

    void build(vector<ll>&a,int x,int lx,int rx){
        if(rx-lx==1){
            if(lx<a.size()){
                seg[x]=a[lx];
            }
            return;
        }
        int m=(lx+rx)/2;
        build(a,2*x+1,lx,m);
        build(a,2*x+2,m,rx);
        seg[x]=max(seg[2*x+1],seg[2*x+2]);
    }

    void build(vector<ll>&a){
        build(a,0,0,size);
    }

    ll maximum(int l,int r,int x,int lx,int rx){
        if(lx>=r||l>=rx)return -1e18;
        if(lx>=l&&rx<=r)return seg[x];
        int m=(lx+rx)/2;
        ll s1=maximum(l,r,2*x+1,lx,m);
        ll s2=maximum(l,r,2*x+2,m,rx);
        return max(s1,s2);
    }

    ll maximum(int l,int r){
        return maximum(l,r,0,0,size);
    }
};



void solve(){
    int n,k,x;
    cin>>n>>k>>x;

    bool pozitivni=true;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]<0)pozitivni=false;
    }

    vector<ll>pref(n);
    for(int i=0;i<n;i++){
        if(i)pref[i]=pref[i-1];
        pref[i]+=a[i];
    }

    vector<ll>sufiksi(n);
    for(int i=n-1;i>=0;i--){
        if(i!=n-1)sufiksi[i]+=sufiksi[i+1];
        sufiksi[i]+=a[i];
    }

    ///for(auto x:sufiksi)cout<<x<<" ";

/**
    ll xovi=0;
    int zzz=1;
    while(zzz--){
        int r=n-1;
        int l=r-k+1;
        for(int i=0,l2=l+1;i<x-1&&l2<=r;i++,l2++){
            cout<<sufiksi[l2]<<" ";
            xovi+=sufiksi[l2];
        }
    }
    cout<<xovi<<endl;

    vector<ll>niz;
    niz.push_back(xovi);
    for(int l=n-1-k;l>=0;l--){
        int r=l+k-1;
        cout<<l<<"-"<<r<<endl;
        xovi-=(x-1)*sufiksi[r+1];
        xovi+=
    }
*/
/**
6 4 3
5 5 5 5 50 500

*/
    /**
    if(pozitivni){
        for(int r=k-1,l=0;r<n;l++,r++){
            ll suma=pref[r];
            if(l)suma-=pref[l-1];
            //cout<<l<<"-"<<r<<endl;
            ///cout<<suma<<" ";

            ll brojevi=0;
            for(int i=0,l2=l+1;i<x-1&&l2<=r;i++,l2++){
                ll broj=sufiksi[l2];
                if(r!=n-1)broj-=sufiksi[r+1];

                ///cout<<broj<<" ";
                brojevi+=broj;
            }
            cout<<suma+brojevi<<" ";
        }
        return;
    }*/

    if(x==2){
        segtree st;
        st.init(n);
        st.build(sufiksi);

        for(int r=k-1,l=0;r<n;l++,r++){
            ll suma=pref[r];
            if(l)suma-=pref[l-1];
            ///cout<<l<<"-"<<r<<endl;
            //cout<<suma<<" ";

            ll mx=st.maximum(l+1,r+1);
            if(r!=n-1)mx-=sufiksi[r+1];

            ///cout<<mx<<" ";
            mx=max(0ll,mx);
            cout<<suma+mx<<" ";
        }

    }





    /// NE DIRAJ
    for(int r=k-1,l=0;r<n;l++,r++){
        ll suma=pref[r];
        if(l)suma-=pref[l-1];
        //cout<<l<<"-"<<r<<endl;
        ///cout<<suma<<" ";

        vector<ll>suf(k,0);
        for(int i=r,idx=k-2;i>l;idx--,i--){
            if(i!=r)suf[idx]=suf[idx+1];
            suf[idx]+=a[i];
        }
        sort(suf.rbegin(),suf.rend());
        ///cout<<suf[0]<<endl;
        ll zbir=0;
        for(int i=0;i<x-1;i++){
            //cout<<suf[i]<<" ";
            zbir+=suf[i];
        }
        //cout<<endl;
        cout<<suma+zbir<<" ";
    }


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