#include <bits/stdc++.h>

using namespace std;

#define NMax 200005

int a[NMax];
vector<int> maksimum;

vector<int> maksimumi(int n, int k, int a[])
{
    int maks=INT_MIN;
    for (int i=0; i<k; i++)
    {
        if (a[i]>maks)
        {
            maks=a[i];
        }
    }
    int j=0;
    maksimum.push_back(maks);
    for (int i=k; i<n; i++)
    {
        if (maks==a[i-k])
        {
            maks=INT_MIN;
            for (int j=i-k+1; j<i+1; j++)
            {
                if (a[i]>maks)
                {
                    maks=a[i];
                }
            }
        }
        else
        {
            if (a[i]>maks)
            {
                maks=INT_MIN;
                for (int j=i-k+1; j<i+1; j++)
                {
                    if (a[i]>maks)
                    {
                        maks=a[i];
                    }
                }
            }
        }
        maksimum.push_back(maks);
    }
}
int ans[NMax];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k, x;
    cin>> n >> k >> x;
    for (int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    maksimumi(n, k, a);
    for (int i=0; i<maksimum.size(); i++)
    {
        //cout<< maksimum[i]<< " ";
        int h=0, g=0;
        for (int j=i; j<i+k; j++)
        {
            if (a[j]==maksimum[i] && maksimum[j]>0)
            {
                ans[i]=ans[i]+2*a[j];
                h=1;
            }
            else
            {
                if (h==1)
                {
                    ans[i]=ans[i]+2*a[j];
                }
                else
                {
                    ans[i]=ans[i]+a[j];
                }
            }
            g=g+a[j];
        }
        ans[i]=max(ans[i], g);
    }
    for (int i=0; i<maksimum.size(); i++)
    {
        cout<< ans[i] << " ";
    }
    return 0;
}