#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

long long resi(vector<long long> v,long long x,long long c,long long n,long long poz,bool promeni,long long a[],long long pz){
if(poz==n && c!=n) return -100000;
if(c==x){
        long long pm=1;
long long aura=0;
//for(long long P=pz;P<=n+pz;P++) cout << a[P] << " ";
//cout << " niz "<<endl;
    for(long long i=pz;i<=n+pz;i++){
            //cout << v[i] << " ";
        if(v[i]==1) pm++;
        aura+=pm*a[i];
       // cout << aura << " +aura " << endl;
    }
    //cout <<" aura "<< endl;
    return aura;
}
if(promeni) v[poz]=1;
if(promeni) c++;
if(c==x){
        long long pm=1;
long long aura=0;
//for(long long P=pz;P<=n+pz;P++) cout << a[P] << " ";
//cout << " niz "<<endl;
    for(long long i=pz;i<=n+pz;i++){
            //cout << v[i] << " ";
        if(v[i]==1) pm++;
        aura+=pm*a[i];
        //cout << aura << " +aura    " << endl;
    }
    //cout <<" aura "<< endl;
    return aura;
}
//for(auto l:v) cout << l << " ";
//cout << endl;
//cout << c-1 <<"  c " <<endl;
return max(resi(v,x,c,n,poz+1,true,a,pz),resi(v,x,c,n,poz+1,false,a,pz));
}

int main(){
ios_base::sync_with_stdio(NULL);
cin.tie(nullptr);
long long n,k,x;
cin >> n >> k >> x;
bool svipoz=true;
long long a[n];
long long zb[n+1];
zb[0]=0;
for(long long i=0;i<n;i++){
    cin >> a[i];
    if(a[i]<0)svipoz=false;
    zb[i+1]=zb[i]+a[i];
}
if(svipoz){
    long long aura=0;
    long long c=1;
    for(long long i=0;i<n-k+1;i++){
            aura=x*(zb[k+i+1]-zb[i]);
    long long pom=i;
            for(long long j=x-1;j>0;j--){
                aura-=j*a[pom];
                pom++;

            }
            //aura=zb[i+x-1]+x*(zb[i+k+1]-zb[i+x]);
        cout << aura << " ";
    }
}
else if(x==2){
    for(long long i=0;i<n-k+1;i++){

        cout << zb[k+i+1]-zb[i]+a[i+k] << " ";
    }
}
else{
for(long long i=0;i<n-k+1;i++){
    //    cout <<i <<". put je ovde " << endl;
vector<long long> c(k,0);
//for(auto l:c) cout << l << " ";
//cout << "       ";
for(long long l=i;l<k+i;l++) cout << a[l] << " ";
//cout << "          ";
//cout  << " " << x <<" "<< k+i-1 <<" "<< i<< endl;
cout << resi(c,x,1,k+i-1,0,false,a,i) << " ";
}
}
cout << "\n";
return 0;
}