#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);
    for(int i = 1; i <= n; i++) cin >> a[i];

    vi p(n+1, 0);
    for(int i = 1; i <= n; i++){
        p[i] = p[i-1] + a[i];
    }
    int ans = 0;
    multiset<int> sf;
    for(int i = 1; i < k; i++){
        sf.insert(p[k] - p[i]);
    }
    ans += p[k];
    multiset<int> pick;
    for(int i = 0; i < x-1; i++){
        ans += *sf.rbegin();
        pick.insert(*sf.rbegin());
        sf.erase(prev(sf.end()));
    }


    cout << ans << '\n';
    int sum = 0;
    for(int i = k+1; i <= n; i++){
        sf.insert(-a[i]);
        ans -= a[i-k];
        ans += (x)*a[i];
        //cout << "new sum " << ans << '\n';
        int big = p[i-1] - p[i-k] - sum;
        /*cout << "picked: ";
        for(int i : pick) cout << i << ' ';
        cout << "\n";
        cout << "av: ";
        for(int i : sf) cout << i << ' ';
        cout << '\n';
        */
        if(sf.find(big) == sf.end()){
            //najveci
            //cout << "najveci " << big + sum << " je bio izabran\n";
            pick.erase(pick.find(big));
            ans -= big + sum;
            //cout << "suma je sad: " << ans << '\n';
            //novi
            ans += *sf.rbegin();
            //cout << "novi je " << *sf.rbegin() << '\n';
            pick.insert(*sf.rbegin());
            sf.erase(prev(sf.end()));
        }
        else sf.erase(sf.find(big));

        if(*sf.rbegin() > *pick.rbegin()){
           // cout << "najveci izabran " << *pick.rbegin() << " je manji od " << *sf.rbegin() << '\n';
            ans -= *pick.rbegin();
            pick.erase(prev(pick.end()));

            ans += *sf.rbegin();
            pick.insert(*sf.rbegin());
            sf.erase(prev(sf.end()));
        }
        sum += a[i];
        cout << ans << '\n';
    }
    return 0;
}