#include <bits/stdc++.h>
#define int long long

using namespace std;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n , k , c , res = 0 , x;
    cin>>n>>k>>c;
    vector<int> v(n);
    cin>>v[0];
    for(int i = 1; i<n; i++){
        cin>>x;
        v[i] = v[i-1]+x;
    }

    priority_queue <pair<int , int> , vector<pair<int , int>> , greater<pair<int , int>>> pq;//po vrednosti

    for(int i = 0; i<k; i++){
        pq.push({v[i] , i});
    }

    priority_queue <pair<int , int> , vector<pair<int , int>> , greater<pair<int , int>>> trenutniV;
    priority_queue <pair<int , int> , vector<pair<int , int>> , greater<pair<int , int>>> trenutniPoz;

    for(int i = 1; i<c; i++){
        trenutniV.push(pq.top());
        trenutniPoz.push({pq.top().second , pq.top().first});
        res += v[k-1] - pq.top().first;
        pq.pop();
    }
    cout<<res+v[k-1]<<" ";
    int prev = res;
    res = 0;

    for(int i = k; i<n; i++){
        pq.push({v[i] , i});
        if(!trenutniPoz.empty() && trenutniPoz.top().first < i-k+1){
            x = v[i-1] - trenutniPoz.top().second;
            prev -= x;

            while(pq.top().second < i-k+1){pq.pop();}

            prev += v[i-1] - pq.top().first;

            trenutniPoz.pop();
            trenutniV.push(pq.top());
            trenutniPoz.push({pq.top().second , pq.top().first});
            pq.pop();
        }

        while(!trenutniV.empty() && trenutniV.top().second < i-k+1){trenutniV.pop();}
        while(pq.top().second < i-k+1){pq.pop();}

        if(!trenutniV.empty() && trenutniV.top().first > /*pq.top().first*/ v[i]){
            x = v[i-1] - trenutniV.top().first;
            prev -= x;

            //while(pq.top().second < i-k+1){pq.pop();}

            prev += v[i] - pq.top().first;

            trenutniV.pop();
            trenutniV.push(pq.top());
            pq.pop();
            prev -= v[i] - v[i-1];
        }
        prev += (v[i]-v[i-1])*(c-1);
        cout<<prev + (v[i] - v[i-k])<<" ";
    }



}