#include <bits/stdc++.h>
#define pb push_back
#define ll long long int
#define pi pair<int, int>
#define all(x) x.begin(), x.end()

using namespace std;


ll Probajsve(int l, int r, int x, vector<ll>& p, vector<ll>& pref)
{
    if(l==r)
    {
        if(x==2) return p[r];
        if(x==1) return max(p[r], (ll)0);
        else return 0;
    }
    if(r-l+1==x-1)
    {
        ll sum=0;
        ll c=1;
        for(int i=l; i<=r; i++)
        {
            sum+=c*p[i];
            c++;
        }
        return sum;
    }
    return max(Probajsve(l+1, r, x, p, pref), pref[r]-pref[l-1]+Probajsve(l+1, r, x-1, p, pref));
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    ll n, k, x;
    cin>>n>>k>>x;
    vector<ll> p(n+1);
    bool sviveci=true;
    for(int i=1; i<n+1; i++)
    {
        cin>>p[i];
        if(p[i]<0) sviveci=false;
    }
    vector<ll> pref(n+1);
    pref[0]=0;
    for(int i=1; i<n+1; i++) pref[i]=pref[i-1]+p[i];
    if(sviveci)
    {
        ll sum=0;
        ll c=1;
        for(int i=1; i<k+1; i++)
        {
            sum+=p[i]*c;
            if(c<x)c++;
        }
        cout<<sum<<" ";
        for(int i=2; i<n-k+2; i++)
        {
            sum-=(pref[i+x-2]-pref[i-2]);
            sum+=(p[i+k-1]*x);
            cout<<sum<<" ";
        }
        cout<<"\n";
    }
    else if(n<=20)
    {
        for(int i=1; i<n-k+2; i++)
        {
            ll suma=pref[i+k-1]-pref[i-1]+Probajsve(i+1, i+k-1, x-1, p, pref);
            cout<<suma<<" ";
        }
        cout<<"\n";
    }

}