#include <bits/stdc++.h>
#define fi first
#define sc second
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define pii pair<int,int>
using namespace std;
typedef long long ll;

#define int long long
signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, k, x; cin >> n >> k >> x;
    vi a(n+1);

    bool pos = true;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[i] < 0) pos = false;
    }
    vi p(n+1, 0);
    for(int i = 1; i <= n; i++){
        p[i] = p[i-1] + a[i];
    }

    if(n<=2){
        for(int i = k; i <= n; i++){
            int ans = 0;
            multiset<int> c;
            for(int j = i-k+1; j <= i; j++){
                c.insert(p[i] - p[j]);
                ans += a[j];
            }

            for(int i = 0; i < x-1; i++){
                ans += *c.rbegin();
                c.erase(prev(c.end()));
            }
            cout << ans << ' ';
        }
    }
    else if(pos){
        int ans = 0;
        for(int i = 1; i <= k; i++){
            ans += min(i, x) * a[i];
        }
        cout << ans << ' ';
        int l = 0, r = x;
        for(int i = k+1; i<=n; i++){
            ans += x*a[i];
            ans -= p[r] - p[l];
            cout << ans << ' ';
            l++, r++;
        }
    }
    else if(x == 2){
        multiset<int> b;
        int ans = 0;
        for(int i = 1; i <= k; i++){
            b.insert(p[k] - p[i]);
            ans += a[i];
        }
        cout << ans + *b.rbegin() << ' ';

        int s = 0;
        for(int i = k+1; i <= n; i++){
            b.erase(b.find(p[i-1] - p[i-k] - s));
            ans -= a[i-k];
            ans += a[i];
            cout << ans + max(0ll, max(*b.rbegin() + a[i], a[i])) << ' ';
            s+=a[i];
        }
    }
    cout << '\n';
    return 0;
}