#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;
   // }

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

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

    multiset<array<ll,2>>ms;
    multiset<ll>MX;
    map<ll,ll>CC;
    for(int i=1;i<=k;++i){
        ms.insert({a[i],0});
        MX.insert(0);
        CC[a[i]]++;
    }

    auto it=ms.begin();
    ll sum=0,cnt=0;
    for(auto[X,_]:ms){
        if(++cnt>=x)break;
        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)[0]&&CC[(*it)[0]]==1){++it;sum+=(*it)[0];sum-=a[i-1];}
        else if(a[i-1]<(*it)[0]){++it;sum+=(*it)[0];sum-=a[i-1];}
        auto iit=prev(ms.upper_bound({a[i-1],*prev(MX.end())+1}));
        MX.erase(MX.find((*iit)[1]));
        ms.erase(iit);
        --CC[a[i-1]];
        bool BB=0;
        if(a[i+k-1]<(*it)[0]){sum-=(*it)[0];--it;sum+=a[i+k-1];BB=1;}
        ms.insert({a[i+k-1],(*it)[1]+1});
        MX.insert((*it)[1]+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<<' ';
    }
}