#include <iostream>
#include<set>
#include<tuple>
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define MAXN (int)2e5+5
using namespace std;
int a[MAXN], s[MAXN], o[MAXN];
int update(int a, int b) {
    return s[a + 1] - s[b + 1];
}
int z = 0;
set<pii>s1, s2, s3;
void add() {
    int x, y;
    tie(x, y) = (*s1.rbegin());
    s1.erase(prev(s1.end()));
    z += x;
    s2.insert({ x,y });
    s3.insert({ y,x });
}
void re(int l,int k,int j) {
    s1.clear(); s2.clear(); s3.clear();
    s1.insert({ 0,k +j });
    o[k + 1] = k;
    for (int i = j+1; i <= k+j-1; i++) {
        s1.insert({ s[i] - s[k +j],i });
        o[i] = k;
    }
    z = s[j] - s[k + j];
    while (!s1.empty() && s2.size() < l - 1) {
        s2.insert(*s1.rbegin());
        int x, y;
        tie(x, y) = *s1.rbegin();
        z += x;
        s3.insert({ y,x });
        s1.erase(prev(s1.end()));
    }
    cout << z << ' ';
}
void solve() {
    int n, k,l; cin >> n >> k >> l;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = n; i >= 1; i--) {
        s[i] = s[i + 1] + a[i];
    }
    re(l,k,1);
    for (int i = 1; i <= n - k; i++) {
        z += a[i + k] *(l);
        z -= a[i];
        while (!s3.empty() && (*s3.begin()).fi <= i+1) {
            int x, y; tie(x, y) = *s3.begin();
            z -= y;
            s2.erase(s2.find({ y,x }));
            s3.erase(s3.begin());
        }
        while (!s1.empty() && (*s1.rbegin()).se <= i+1) {
            s1.erase(prev(s1.end()));
        }
        int e =-1e18;
        s1.insert({ -s[k+1]+s[i+k+1],k + i + 1});
        o[k + i+1] = k + i;
        if (l > 1 && !s1.empty() && s2.size() != l - 1) {
            add();
        }if (!s2.empty() && !s1.empty() && (*s2.begin()).fi  <= e) {
            int x, y; tie(x, y) = *s2.begin();
            z -= x;
            s2.erase(s2.begin());
            s3.erase(s3.find({ y,x }));
            add();
        }
        cout << z << ' ';
    }cout << '\n';
}
int32_t main()
{
    ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
    solve();
    return 0;
}