#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ff first
#define ss second
#define ll long long
using namespace std;

const int N = 200'010;
ll pref[N];

int main()
{
    FAST;
    int n, k, x; cin >> n >> k >> x;
    vector < ll > v(n + 1);
    for(int i = 1; i <= n; i++) cin >> v[i];
    for(int i = 1; i <= n; i++) pref[i] = pref[i - 1] + v[i];


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

    ll ans = 0;
    int cnt = 0;
    for(auto it : mns)
    {
        if((cnt >= x - 2 && it > 0) || cnt >= x - 1) break;
//        cout << it << " => \n";
        ans = ans - it + pref[k];
        cnt++;
    }
    ans = ans + pref[k];
    cout << ans << " ";

    for(int i = k + 1; i <= n; i++)
    {
        mns.erase(mns.find(pref[i - k]));
        mns.insert(pref[i]);

//        cout << i << ": ";
//        for(auto it : mns) cout << it << " ";
//        cout << "\n";

        ll ans = 0ll;
        cnt = 0;
        for(auto it : mns)
        {
            if((cnt >= x - 2 && it - pref[i - k] > 0) || cnt >= x - 1) break;
            ans = ans - it + pref[i];
//            cout << it << " " << pref[i] << "---\n";
            cnt++;
        }

//        cout << "taken: " << cnt << "\n";

        ans = ans - pref[i - k] + pref[i];
        cout << ans << " ";
    }

    return 0;
}