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

const int MAXN=200009,INF=3000000000000009;
int niz[MAXN],suf[MAXN];
int n,k,x;
void tst1(){
    multiset<int> skup;

    for(int i=2; i<=k+1; i++) skup.insert(suf[i]);
    if(k==1){
        for(int i=k; k<=n; i++) cout << suf[i-k+1]-suf[i+1] << " ";
        return;
    }
    int br=0,rez=0;
    for(auto X:skup){
        br++;
        if(br>k-(x-1))
            rez+=X;
    }
    cout << suf[1]-suf[k+1]+rez-(x-1)*suf[k+1] << " ";
    for(int i=k+1; i<=n; i++){
        skup.erase(suf[i-k+1]);
        skup.insert(suf[i+1]);
        br=0;rez=0;
        for(auto X:skup){
            br++;
            if(br>k-(x-1))
                rez+=X;
        }
        cout << suf[i-k+1]-suf[i+1]+rez-(x-1)*suf[i+1] << " ";
    }


}

struct Cvor{
    int L=0,R=0,br=0,sum=0;
};

Cvor seg[4000000];
int indx=1;
void upd(int node,int l,int d,int ind,int val){
    if(l==d&&l==ind) {seg[node].br+=val; seg[node].sum+=val*l; return;}
    int s=l+d>>1;
    if(ind<=s){
        if(!seg[node].L) seg[node].L=++indx;
        upd(seg[node].L,l,s,ind,val);
    }
    else{
        if(!seg[node].R) seg[node].R=++indx;
        upd(seg[node].R,s+1,d,ind,val);
    }
    seg[node].br=seg[seg[node].L].br+seg[seg[node].R].br;
    seg[node].sum=seg[seg[node].L].sum+seg[seg[node].R].sum;
}
int query_broj(int node,int l,int d,int poc,int kr){
    if(node==0) return 0;
    if(poc<=l&&d<=kr) return seg[node].br;
    int s=l+d>>1;
    return query_broj(seg[node].L,l,s,poc,kr)+query_broj(seg[node].R,s+1,d,poc,kr);
}
int query_sum(int node,int l,int d,int poc,int kr){
    if(node==0) return 0;
    if(poc<=l&&d<=kr) return seg[node].sum;
    int s=l+d>>1;
    return query_sum(seg[node].L,l,s,poc,kr)+query_sum(seg[node].R,s+1,d,poc,kr);
}








signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

    cin >> n >> k >> x;
    for(int i=1; i<=n; i++) cin >> niz[i];
    suf[n+1]=0;
    for(int i=n; i>0; i--) suf[i]=niz[i]+suf[i+1];
    //if(n<=3000) {tst1(); return 0;}
    for(int i=2; i<=k+1; i++) upd(1,-INF,INF,suf[i],1);
    int l=-INF,d=INF,ind;
    while(l<=d){
        int s=l+d>>1;
        if(query_broj(1,-INF,INF,s,INF)>=x-1){
            ind=s;
            l=s+1;
        }
        else
            d=s-1;
    }
    int rez=query_sum(1,-INF,INF,ind,INF)-(query_broj(1,-INF,INF,ind,INF)-(x-1))*ind;
    cout << suf[1]-suf[k+1]+rez-(x-1)*suf[k+1] << " ";
    for(int i=k+1; i<=n; i++){
        //skup.erase(suf[i-k+1]);
        upd(1,-INF,INF,suf[i-k+1],-1);
        //skup.insert(suf[i+1]);
        upd(1,-INF,INF,suf[i+1],1);
        l=-INF;d=INF;ind=0;
        while(l<=d){
            int s=l+d>>1;
            if(query_broj(1,-INF,INF,s,INF)>=x-1){
                ind=s;
                l=s+1;
            }
            else
                d=s-1;
        }
        rez=query_sum(1,-INF,INF,ind,INF)-(query_broj(1,-INF,INF,ind,INF)-(x-1))*ind;
        cout << suf[i-k+1]-suf[i+1]+rez-(x-1)*suf[i+1] << " ";
    }



    return 0;
}