#include<bits/stdc++.h>
using namespace std;
using ll=long long;

const ll N=2e5+555,M=2e14+3;
ll a[N],n,k,x;

struct node{
    ll sum=0;
    int C=0;
}st[42*N];
int lc[42*N],rc[42*N],nd=2;

void upd(ll id,ll x,ll i=1,ll tl=1,ll tr=2*M+9){
    if(tl==tr){
        st[i].C+=x;
        st[i].sum+=x*(id-M);
        return;
    }
    ll md=(tl+tr)/2;
    if(id<=md){
        if(!lc[i])lc[i]=++nd;
        upd(id,x,lc[i],tl,md);
    }else{
        if(!rc[i])rc[i]=++nd;
        upd(id,x,rc[i],md+1,tr);
    }
    st[i].C=st[lc[i]].C+st[rc[i]].C;
    st[i].sum=st[lc[i]].sum+st[rc[i]].sum;
}

ll walk(ll k,ll i=1,ll tl=1,ll tr=2*M+9){
    if(k<=0)return 0;
    if(tl==tr)return (tl-M)*k;
    if(k==st[i].C)return st[i].sum;
    ll md=(tl+tr)/2;
    if(k>st[lc[i]].C)return st[lc[i]].sum+walk(k-st[lc[i]].C,rc[i],md+1,tr);
    return walk(k,lc[i],tl,md);
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin>>n>>k>>x;
    for(int i=1;i<=n;++i){
        cin>>a[i];
        a[i]+=a[i-1];
    }

    for(int i=1;i<=k;++i)
        upd(M+a[i],1);

    cout<<x*a[k]-walk(x-1)<<' ';
    for(int i=2;i+k-1<=n;++i){
        upd(M+a[i-1],-1);
        upd(M+a[i+k-1],1);
        cout<<x*a[i+k-1]-a[i-1]-walk(x-1)<<' ';
    }
}