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

const int MAXN=200009;
int niz[MAXN];
int n,k,x;
void tst1(){
    multiset<int> skup;
    int suf[n+2];
    suf[n+1]=0;
    for(int i=n; i>0; i--) suf[i]=niz[i]+suf[i+1];
    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] << " ";
    }


}




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];
    tst1();



    return 0;
}