#include<bits/stdc++.h>

using namespace std;

#define int long long

void solve(){
    int n, k, x;
    cin>>n>>k>>x;
    vector<int> v(n+5);
    for(int i = 1;i<=n;i++) cin>>v[i];
    vector<int> s(n+5);
    s[k] = v[k];
    for(int i = k-1;i>=1;i--) s[i] = s[i+1]+v[i];
    s[k+1] = 0;
    for(int i = k+2;i<=n+1;i++) s[i] = s[i-1]-v[i-1];
    multiset<int> f;
    f.insert(0);
    int s0 = s[1], d = 0;
    int rez = s0;
    for(int i = 2;i<=k;i++){
        rez+=s[i];
        f.insert(s[i]);
    }
    for(int i = 0;i<k-x;i++){
        rez-=(*f.begin());
        f.erase(f.begin());
    }
    cout<<rez-(*f.begin())<<" ";
    int sz = x;
    for(int i = k+1;i<=n;i++){
        auto ii = f.find(s[i-k+1]);
        if(ii!=f.end()){
            f.erase(ii);
            sz--;
        }else{
            rez+=s[i-k+1];
        }
        rez-=s0;
        s0 = s[i-k+1];
        f.insert(s[i+1]);
        rez+=s[i+1];
        sz++;
        if(sz>x){
            f.erase(f.begin());
            rez-=s[i+1];
            sz--;
        }
        d+=v[i];
        //cout<<rez<<" "<<d<<" "<<(*f.begin())<<endl;
        cout<<rez+x*d-(*f.begin())<<" ";
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
}