#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];

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;
    }
    bool subtask2=true;
    for (int i=1;i<=n;i++)
    {
        if (p[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 l=1;l<=n-k+1;l++)
        {
            int r=l+k-1,prvix=l+x-1;
            if (prvix<=r)
            {
                int maxanswer=cudno[prvix-1]-cudno[l-1]+x*(pref[r]-pref[prvix-1]);
                cout<<maxanswer<<endl;continue;
            }
            else 
            {
                int maxanswer=cudno[r]-cudno[l-1];cout<<maxanswer<<endl;continue;
            }
        }
    }
    ///sad samo treba naci pocetni maximalni answer za podniz 1 do k
    /*answer[k]=-LLONG_MAX;
    if (x==2)
    {
        for (int i=k;i>=1;i--) answer[k]=max(answer[k],pref[i]+2*(pref[k]-pref[i]));
        for (int i=k+1;i<=n;i++)
        {
            answer[i]=pref[i]-pref[i-k];
            if (answer[i-1]+2*a[i]-a[i-k]==2*(pref[i]-pref[i-k])) answer[i]=max(answer[i],2*(pref[i]-pref[i-k])-pref[i-k+1]);
            else answer[i]=max(answer[i],answer[i-1]+2*a[i]-a[i-k]);
        }
        for (int i=k;i<=n;i++) cout<<answer[i]<<" ";
        cout<<endl;
    }*/
}