#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;


int main()

{
    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int n,k,x;
    cin>> n>>k>>x;

    vector<long long> p(n+1),P(n+ 1);

    P[0]=0;


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

        cin>>p[i];

        P[i]=P[i-1]+p[i];

    }



    multiset<long long> manji,veci;

    long long manjiSum=0;


    vector<long long> sadrzi;
    for(int i=1;i <=k;i++)
    {
        sadrzi.push_back(P[i]);

    }
    sort(sadrzi.begin(),sadrzi.end());



    for(int i=0;i<x-1;i++)
    {


        manji.insert(sadrzi[i]);

        manjiSum += sadrzi[i];



    }
    for (int i=x-1;i<k;i++)
    {

        veci.insert(sadrzi[i]);


    }

    for (int j=1;j<=n-k+1;j++)

        {

        long long ans =(long long)x*P[j+k-1] -P[j -1]-manjiSum;
        cout<<ans<<(j==n-k+1 ? "\n" : " ");

        if (j==n-k+1)
            break;

        long long skloni=P[j];
        long long dodaj=P[j+k];


        multiset<long long>::iterator trazeni=manji.find(skloni);

        if(trazeni!=manji.end())
        {
            manji.erase(trazeni);

            manjiSum -= skloni;
        }

        else

        {
            veci.erase(veci.find(skloni));
        }


        if((int)manji.size()<x-1)
        {
            manji.insert(dodaj);

            manjiSum+=dodaj;

        }
        else if (x>1 && dodaj <*manji.rbegin())

        {


            long long pomeraj= *manji.rbegin();

            manji.erase(manji.find(pomeraj));

            manjiSum -= pomeraj;
            veci.insert(pomeraj);

            manji.insert(dodaj);

            manjiSum+= dodaj;
        }

        else

        {


            veci.insert(dodaj);

        }


        while( (int)manji.size() < x-1 &&!veci.empty())
        {
            long long mv= *veci.begin();

            veci.erase(veci.begin());

            manji.insert(mv);
            manjiSum += mv;
        }
    }

    return 0;
}