#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int comp_pair(pair<int,long long> a,pair<int,long long> b){
    return a.second>b.second;
}
int comp(long long a,long long b){return a>b;}

int main()
{
    int n,k,x;
    cin>>n>>k>>x;
    x--;
    vector<int> nums(n);
    for(int i=0;i<n;i++)cin>>nums[i];
    vector<pair<int,long long>> prefixsum(n);
    pair<int,long long> cur;
    cur.first=n-1;cur.second=0;
    prefixsum[n-1]=cur;
    long long sum=nums[n-1];
    for(int i=n-2;i>=0;i--){cur.first=i;cur.second=sum; prefixsum[i]=cur;sum+=nums[i];}
   // for(int i=0;i<n;i++)cout<<prefixsum[i].first<<')'<<prefixsum[i].second<<endl;
    vector<pair<int,long long>> kbest(k);
    long long sumel=0;
    for(int i=0;i<k;i++){kbest[i]=prefixsum[i];sumel+=nums[i];}
    sort(kbest.begin(),kbest.end(),comp_pair);
    for(int i=0;i<x;i++)sumel+=kbest[i].second-prefixsum[k-1].second;
    cout<<sumel;
    for(int i=k;i<n;i++){
        for(int j=0;j<k;j++){
            if(kbest[j].first==i-k){
             //   cout<<"erasing"<<kbest[j].first<<')'<<kbest[j].second<<endl;
                for(int jer=j;jer<k-1;jer++)kbest[jer]=kbest[jer+1];
                break;
            }
        }
        kbest[k-1]=prefixsum[i];
        int jer=k-1;
        while(jer>0){ if(kbest[jer].second>kbest[jer-1].second){cur=kbest[jer];kbest[jer]=kbest[jer-1];kbest[jer-1]=cur;} jer--; }
       // cout<<"kbest:"; for(int j=0;j<k;j++)cout<<kbest[j].first<<')'<<kbest[j].second<<' ';
       // cout<<"start_sum="<<prefixsum[i-k].second<<'-'<<prefixsum[i].second<<endl;
        sumel=-prefixsum[i].second+prefixsum[i-k].second;
        for(jer=0;jer<x;jer++){
   //             cout<<"+"<<kbest[jer].second-prefixsum[i].second<<endl;
            sumel+=kbest[jer].second-prefixsum[i].second;
        }
        cout<<' '<<sumel;
    }










    /*
    multiset<long long> kbest;
    vector<long long> firstk(k);
    for(int i=0;i<k;i++)firstk[i]=prefixsum[i].second;
    sort(firstk.begin(),firstk.end(),comp);
    for(int i=0;i<k;i++){kbest.insert(firstk[i]);}
    long long sumel=0;
    cout<<"kbest:";
    for(auto el:kbest){sumel+=el;cout<<el<<endl;}
    cout<<sumel<<endl;
    for(int i=k;i<n;i++){
        if(kbest.find(prefixsum[i-k].second)<x){sumel-=prefixsum[i-k].second;
        kbest.insert(prefixsum[i].second);
        sumel+=kbest[x-1];
        }
        else{
           kbest.insert(prefixsum[i].second);
           if(kbest.find(prefixsum[i].second)<x){sumel+=prefixsum[i].second;sumel-=kbest[x];}
        }
        cout<<sumel<<endl;
    }
    cout << "Hello world!" << endl;
    */
    return 0;
}