#include <bits/stdc++.h>
using namespace std;
pair<long long int, int> par;
void unos(vector<int> &v, int n)
{
    for(int i=0;i<n;i++)
    {
        cin >> v.at(i);
    }
}
void ostatak(vector<int> &p, int v, int i, int n, int z, int x, int br)
{
    //cout << v << " " << p[i] << " " << i << " " << n << " " << z << " " << x << " " << br << endl;
    if(n==i)
    {
        if(par.first < v && br != -1)
        {
            par = {v, br};
        }
        return;
    }
    if(x-z==n-i+1)
    {
        if(br == -1)
            ostatak(p, p[i]*(z+1)+v, i+1, n, z+1, x, 1);
        else
            ostatak(p, p[i]*(z+1)+v, i+1, n, z+1, x, br);
    }
    else if(x-z>0)
    {
        if(br == -1)
            ostatak(p, p[i]*z+v, i+1, n, z, x, 0);
        else
            ostatak(p, p[i]*z+v, i+1, n, z, x, br);
        if(br == -1)
            ostatak(p, p[i]*(z+1)+v, i+1, n, z+1, x, 1);
        else
            ostatak(p, p[i]*(z+1)+v, i+1, n, z+1, x, br);
    }
    else
        ostatak(p, p[i]*z+v, i+1, n, z, x, br);
}
void racun(vector<int> &p, int &n, int &k, int &x, int &a, int &c)
{
    for(int i=0;i<n-k+1;i++)
    {
        int aura = a, z = c;
        //cout << aura << " " << p.at(i) << " " << z << endl;
        aura += p.at(i)*z;

        par = {LONG_MIN, 0};

        if(x-z == k)
            z ++;
        else if(x!=z)
        {
            ostatak(p, 0, i+1, i+k, z, x, -1);
            z += par.second;
            //cout << par.second << "\n";
        }

        for(int j=i+1;j<i+k;j++)
        {
            //cout << aura << " " << p.at(j) << " " << z << endl;
            aura += p.at(j)*z;
            if(j+1==i+k)
                break;
            //cout << k-z << " " << n-k-i << " " << (ostatak(p, i+1, n-k) && z < k) << "\n";
            par = {LONG_MIN, -1};
            if(x-z == i+k-j)
                z++;
            else if(x!=z)
            {
                ostatak(p, 0, j+1, i+k, z, x, -1);
                z += par.second;
                //cout << par.second << "\n";
            }
        }
        cout << aura << " ";
    }
}
int main()
{
    int n, k, x, a=0, c=1;
    cin >> n;
    cin >> k;
    cin >> x;
    vector<int> p(n);
    unos(p, n);
    racun(p, n, k, x, a, c);
    return 0;
}