#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int>st;
vector<int>a;
vector<int>suf;
void build(int l, int r,int node){
if(l==r)
st[node]=suf[l];
else{
int mid=(l+r)/2;
build(l,mid,2*node);
build(mid+1,r,2*node+1);
st[node]=max(st[2*node],st[2*node+1]);

}


}
int rez(int tl,int tr,int l,int r,int node){
if(l<=tl&&tr<=r)
return st[node];
if(r<tl||l>tr)
return 0;
int mid=(tl+tr)/2;
if(mid<tl)
return rez(mid+1,tr,l,r,2*node+1);
else if(mid>tr)
return rez(tl,mid,l,r,2*node);
else
return max(rez(mid+1,tr,l,r,2*node+1),rez(tl,mid,l,r,2*node));



}

#include <bits/stdc++.h>

using namespace std;
#define int long long
signed main()
{
int n,k,x;
cin>>n>>k>>x;
/*
multiset<int>a;
a.extract(67);
*/
a.resize(n,0);
for(int i = 0;i<n;i++){
cin>>a[i];
}
bool poz=true;
for(int i = 0;i<n;i++)
if(a[i]<0)
poz=false;
vector<int>pref(n);
pref[0]=a[0];
for(int i = 1;i<n;i++)
pref[i]=pref[i-1]+a[i];
if(x==2){
suf.resize(n);
st.resize(4*n);
suf[n-1]=a[n-1];
for(int i = n-2;i>=0;i--)
suf[i]=suf[i+1]+a[i];
build(0,n-1,1);
for(int i = 0;i<n-k+1;i++){
int w=rez(0,n-1,i+1,i+k-1,1);
int ww;
if(i>0)
ww=pref[i+k-1]-pref[i-1];
else
ww=pref[i+k-1];
//cout<<"ww rn is : "<<ww<<endl;
if(i+k<n)
ww+=w-suf[i+k];
else
ww+=w;
cout<<ww<<" ";
}






}
else if((n-k)*(k+30)<10000000&&poz==false){
for(int i = 0;i<n-k+1;i++){
vector<int>v(1);
for(int j = i+1;j<i+k;j++){
if(j>0){
v.push_back(pref[i+k-1]-pref[j-1]);
}
else
v.push_back(pref[i+k-1]);
}
int res=0;
if(i>0){
res+=(pref[i+k-1]-pref[i-1]);
}
else
res+=(pref[i+k-1]);

sort(v.rbegin(),v.rend());

for(int k= 0;k<x-1;k++)
res+=v[k];
cout<<res<<" ";
}

}
if(poz==true){
vector<int>poc(n);
for(int i = 0;i<x;i++)
poc[0]+=a[i]*(i+1);
for(int i = 1;i<n-x+1;i++){
if(i>=2)
poc[i]=poc[i-1]-(pref[i+x-2]-pref[i-2])+x*a[i+x-1];
else
poc[i]=poc[i-1]-(pref[x-1])+x*a[i+x-1];

}
/*
for(int i = 0;i<n;i++)
cout<<poc[i]<<" ";
cout<<endl;
*/
for(int i = 0;i<n-k+1;i++){
int res=poc[i]+x*(pref[i+k-1]-pref[i+x-1]);
cout<<res<<" ";
}

}






    return 0;
}