#include <bits/stdc++.h>
#define endl '\n'
#define pii pair<int,int>
#define fi first
#define se second
#define int long long

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int sum=0,n,k,x;
    cin>>n>>k>>x;
    int a[n];
    int suf[n+1];
    suf[n]=0;
    multiset<int>st;
    bool allgr=true;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]<0)allgr=false;
    }
    if(x==2){
        for(int i=n-1;i>=0;i--)suf[i]=suf[i+1]+a[i];
        sum=a[0];
        for(int i=1;i<k;i++){
            sum+=a[i];
            st.emplace(suf[i]);
        }
        cout<<max(sum,sum+(*prev(st.end()))-suf[k])<<' ';
        for(int i=k;i<n;i++){
            sum-=a[i-k];
            sum+=a[i];
            st.erase(st.find(suf[i-k+1]));
            st.emplace(suf[i]);
            cout<<max(sum,sum+(*prev(st.end()))-suf[i+1])<<' ';
        }
    }
    else if(allgr){
        int pref[n];
        pref[0]=a[0];
        for(int i=1;i<n;i++)pref[i]=pref[i-1]+a[i];
        for(int i=0;i<k;i++){
            sum+=a[i]*min(x,i+1);
        }
        cout<<sum<<' ';
        for(int i=k;i<n;i++){
            sum+=x*a[i];
            sum-=pref[i-k+x-1]-(i-k==0?0:pref[i-k-1]);
            cout<<sum<<' ';
        }
    }
    cout<<endl;
    return 0;
}