#include <bits/stdc++.h>
using namespace std;
long long N,K,X,sum,c,k, sol,br;
long long a[200022],ps[200022];
void resi(int L, int R){
    k=1<<K;
    k--;
    sol=-1e13;
    while(k){
        br=1<<(K-1);
        sum=0;
        c=1;
        for(int i=L;i<=R;i++){
            sum+=a[i]*c;
            if(br&k){
                c++;
                c=min(X,c);
            }
            br/=2;
        }
        if(c==X)
            sol=max(sol, sum);
        k--;
    }

    return;
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> K >> X;
    for(int i=1;i<=N;i++){
        cin >> a[i];
    }
    if(N<=20)
    {
        for(int i=1;i<=N-K+1;i++){
            resi(i,i+K-1);
            cout << sol << " ";
        }
        cout << "\n";


        return 0;
    }
    for(int i=1;i<=N;i++){
        ps[i]=a[i]+ps[i-1];
    }

    c=1;
    for(int i=1;i<=K;i++){
        sum+=c*a[i];
        if(c<X) c++;
    }
    cout << sum << " ";
    for(int j=K+1;j<=N;j++){
        sum+=X*a[j];
        sum-=(ps[j-K+X-1]-ps[j-K-1]);
        cout << sum << " ";
    }
    cout << endl;



    return 0;
}
/// 7 3 1   2 3 5 2 1 3 7