#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("avx2")

using namespace std;
using ll = long long;
#define pb push_back

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, x, k;
    cin >> n >> k >> x;
    ll s[n+2], a[n+2];  s[n+1] = 0;
    for (int i = 1; i <= n; ++i)    cin >> a[i];
    for (int i = n; i >= 1; --i)    s[i] = s[i+1]+a[i];
    ll f[n+1], c[n+1];
    fill(f, f+n+1, 0);
    set<int> st;
    st.insert(n+5);
    int id[n+1];
    for (int i = 1; i <= n; ++i)    id[i] = i, c[i] = x-1, st.insert(i);
    sort(id+1, id+n+1, [&](int x, int y) {
            return s[x] > s[y];
    });
    for (int i = 1; i <= n; ++i) {
        int p = id[i];
        int j = *st.lower_bound(p-k);
        while (j < p) {
            c[j]--, f[j] += s[p];
            if (!c[j])  st.erase(j);
            j = *st.upper_bound(j);
        }
    }
    for (int i = 1; i <= n-k+1; ++i) {
        cout << f[i]+s[i]-x*s[i+k] << ' ';
    }
    cout << '\n';
}