#include <bits/stdc++.h>

using namespace std;

#define MAXN 200001
#define int long long

int n,k,x,a[MAXN];
int pref[MAXN];
int change[MAXN];
int answer[MAXN];
bool povecaj[MAXN];
int cudno[MAXN];
multiset<int> values;

int32_t main()
{
    cin>>n>>k>>x;
    for (int i=1;i<=n;i++) cin>>a[i];
    pref[0]=0;for (int i=1;i<=n;i++) pref[i]=pref[i-1]+a[i];
    if (n<=20)
    {
        for (int l=1;l<=n-k+1;l++)
        {
            int maxanswer=-LLONG_MAX;
            for (int bitmask=0;bitmask<(1<<k);bitmask++)
            {
                for (int bit=0;bit<k;bit++)
                {
                    if (bitmask&(1<<bit)) povecaj[l+bit]=true;
                }
                int curranswer=0,c=1;
                for (int j=l;j<l+k;j++)
                {
                    curranswer+=(long long)c*a[j];
                    if (povecaj[j]) c++;
                }
                for (int j=l;j<l+k;j++) povecaj[j]=false;
                if (c!=x) continue;
                maxanswer=max(maxanswer,curranswer);
            }
            cout<<maxanswer<<" ";
        }
        cout<<endl;return 0;
    }
    bool subtask2=true;
    for (int i=1;i<=n;i++)
    {
        if (a[i]<0) {subtask2=false;break;}
    }
    if (subtask2)
    {
        cudno[0]=0;for (int i=1;i<=n;i++) cudno[i]=cudno[i-1]+(long long)i*a[i];
        for (int i=1;i<=n-k+1;i++)
        {
            int maxanswer=0;int limit=i+x-2;
            maxanswer=cudno[limit]-cudno[i-1]-(long long)(i-1)*(pref[limit]-pref[i-1]);
            maxanswer+=(long long)x*(pref[i+k-1]-pref[limit]);
            cout<<maxanswer<<" ";
        }
        cout<<endl;return 0;
    }
    if (x==2)
    {
        for (int i=1;i<=k;i++) values.insert(pref[i]);
        auto pocetak=values.begin();answer[k]=2*pref[k]-(*pocetak);
        for (int i=k+1;i<=n;i++)
        {
            values.erase(values.find(pref[i-k]));values.insert(pref[i]);
            auto it=values.begin();answer[i]=2*pref[i]-(*it)-pref[i-k];
        }
        for (int i=k;i<=n;i++) cout<<answer[i]<<" ";
        cout<<endl;return 0;
    }
    if (n<=3000)
    {
        for (int i=1;i<=k;i++) values.insert(pref[i]);
        auto it0=values.begin();int curr=1;
        while (curr<=x-1) {answer[k]-=(*it0);curr++;it0++;}
        answer[k]+=(long long)x*pref[k];
        for (int i=k+1;i<=n;i++)
        {
            values.erase(values.find(pref[i-k]));values.insert(pref[i]);
            auto it=values.begin();int currnum=1;
            while (currnum<=x-1) {answer[i]-=(*it);currnum++;it++;}
            answer[i]+=(long long)x*pref[i]-pref[i-k];
        }
        for (int i=k;i<=n;i++) cout<<answer[i]<<" ";
        cout<<endl;return 0;
    }
    return 0;
}