#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main()
{
    int n, k, x, z=0, ans=0, mna=-1e9-1, kmna=0;
    cin >>n >> k >> x;
    vector<int> a(n+1);
    vector<int> ps(n+1);
    vector<int> mn(n-k+1);
    vector<vector<int>> v(n+1, vector<int>(x+1,1));
    ps[0]=0;
    for (int i=1; i<= n; i++)
    {
        cin >> a[i];
        ps[i]=ps[i-1]+a[i];
    }
    for (int i=1; i<= n; i++)
    {
        for (int j=1; j<= x; j++)
        {
            v[i][j]=a[i]*j;
        }
    }
    /*for (auto i:v)
    {
        for (auto j:i)
            cout << j << " " ;
        cout << endl;
    }*/

    vector<int> dp(k+1);
    vector<int> rdp(k+1);
    dp[0]=v[1][1];
    rdp[0]=v[k][x];
    int c=1, rc=x;
    for (int i=1; i<=k;i++)
    {
        if(c==x)
            dp[i]=dp[i-1]+v[i][c];
        else if (x-c-1==k-i)
        {
            c++;
            dp[i]=dp[i-1]+v[i][c];
        }
        else if(dp[i-1]+v[i][c+1] > dp[i-1]+v[i][c])
        {
            c++;
            dp[i]=dp[i-1]+v[i][c];
        }
        else
            dp[i]=dp[i-1]+v[i][c];

        if(rc==1)
            rdp[i]=rdp[i-1]+v[k-i][c];
        else if (rc==k-i)
        {
            rc--;
            rdp[i]=rdp[i-1]+v[k-i][c];
        }
        else if(rdp[i-1]+v[k-i][c-1] > rdp[i-1]+v[k-i][c])
        {
            c--;
            rdp[i]=rdp[i-1]+v[k-i][c];
        }
        else
            rdp[i]=rdp[i-1]+v[k-i][c];
    }
    vector<int> dpl(k+1);
    vector<int> rdpl(k+1);
    dpl[0]=v[1][1];
    rdpl[0]=v[k][x-1];
    c=1, rc=x-1;
    for (int i=1; i<=k;i++)
    {
        if(c==x)
            dpl[i]=dpl[i-1]+v[i][c];
        else if (x-c==k-i)
        {
            c++;
            dpl[i]=dpl[i-1]+v[i][c];
        }
        else if(dpl[i-1]+v[i][c+1] > dpl[i-1]+v[i][c])
        {
            c++;
            dpl[i]=dpl[i-1]+v[i][c];
        }
        else
            dpl[i]=dpl[i-1]+v[i][c];

        if(rc==1)
            rdpl[k-i]=rdpl[i-1]+v[k-i][c];
        else if (rc==k-i)
        {
            rc--;
            rdpl[k-i]=rdpl[i-1]+v[k-i][c];
        }
        else if(rdpl[i-1]+v[k-i][c-1] > rdpl[i-1]+v[k-i][c])
        {
            c--;
            rdpl[k-i]=rdpl[i-1]+v[k-i][c];
        }
        else
            rdpl[k-i]=rdpl[i-1]+v[k-i][c];
    }
    /*for (auto i: dp)
        cout << i << " ";
    cout << endl;
    for (auto i: rdp)
        cout << i << " ";
    cout << endl;
    for (auto i: dpl)
        cout << i << " ";
    cout << endl;
    for (auto i: rdpl)
        cout << i << " ";
    cout << endl;*/
    ans=max(max(dp[k],rdp[k]), max(dpl[k],rdpl[k]) );
    cout << ans << endl;
    for (int i=1; i<=n-k;i++)
    {
        ans=max(ans-(ps[i+k-1]-ps[i-1])+a[i+k]*x, ans-(ps[i+k-1]-ps[i-1])+a[i+k]*(x-1));
        cout << ans << endl;
    }
}