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

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

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];
        //cout<<a[i]<<' ';
    }
    //cout<<endl;

    //if(k==1){
     //   for(int i=1;i<=n;++i)
     //       cout<<a[i]-a[i-1]<<' ';
   //     return 0;
   // }

    //-suma x-1 najmanjih iz [i,i+k-2]+x*a[i+k-1]-a[i-1]

    multiset<ll>ms;
    for(int i=1;i<=k;++i)
        ms.insert(a[i]);

    auto it=ms.begin();
    map<ll,ll>CC;
    ll sum=0,cnt=0;
    for(ll X:ms){
        if(++cnt>=x)break;
        CC[X]++;
        it=next(it);
        sum+=X;
    }
    it=prev(it);
    //cout<<*it<<endl;

    cout<<x*a[k]-sum<<' ';
    for(int i=2;i+k-1<=n;++i){
        if(a[i-1]==*it&&CC[*it]==1){sum+=*++it;sum-=a[i-1];}
        else if(a[i-1]<*it){sum+=*++it;sum-=a[i-1];}
        ms.erase(ms.find(a[i-1]));
        --CC[a[i-1]];
        if(a[i+k-1]<*it){sum-=*it--;sum+=a[i+k-1];}
        ms.insert(a[i+k-1]);
        ++CC[a[i+k-1]];
        //for(ll X:ms)cout<<X<<' ';
        //cout<<'.'<<sum<<endl;
        //cout<<sum<<' ';
        cout<<x*a[i+k-1]-a[i-1]-sum<<' ';
    }
}