#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k,x;
    bool poz = true;
    cin >> n >> k >> x;
    long long a[n];
    for ( int i = 0 ; i < n ; i++)
    {
        cin >> a[i];
        if ( a[i] < 0 ) poz = false;
    }
    long long s = 0;
    long long ps[n+1];
    ps[n] = 0;
    for ( int i = n-1 ; i >= 0 ; i--)
    {
        s += a[i];
        ps[i] = s;
    }
    if ( x == 2)
    {

        for ( int i = 0 ; i < n ; i++)
        {

        }
    }
    else if(poz)
    {
        long long u = 0;
        vector<long long> res;
        for ( int i = 0 ;i < x;i++)
            u+= ps[i];
        for ( int i = k ; i < n ; i++)
        {
            res.push_back(u - x*ps[i]);
            u -= ps[i-k];
            u += ps[i-k + x];
        }
        res.push_back(u);
        for ( int i= 0; i < res.size() ; i++) cout << res[i] << " ";
    }
    else
    {
        vector<long long> res;
        vector<pair<long long,long long>>v;
        for ( int i = 0 ; i < k ; i++)
        {
            v.push_back(make_pair(ps[i],i));
            int j = i;
            while(j >= 1 && v[j].first > v[j-1].first)
            {
                pair pp = v[j];
                v[j] = v[j-1];
                v[j-1] = pp;
                j--;
            }
        }
        for ( int i = k ; i <= n ; i++)
        {
            long long u = 0;
            for ( int j = 0 ; j < k ; j++)
            {
                if ( v[j].second == i -k)
                {
                    u += v[j].first;
                    v.erase(v.begin()+ j);
                    break;
                }
            }
            for ( int l = 0 ; l < x - 2; l++) u += v[l].first;
            u -=ps[i]*(x-1);
            if ( v[x-2].first - ps[i] >= 0) u += v[x-2].first - ps[i];
            res.push_back(u);
            v.push_back(make_pair(ps[i],i));
            int j = k-1;
            while(j >= 1 && v[j].first > v[j-1].first)
            {
                pair pp = v[j];
                v[j] = v[j-1];
                v[j-1] = pp;
                j--;
            }
        }
        for ( int i= 0; i < res.size() ; i++) cout << res[i] << " ";
    }

}