#include<bits/stdc++.h>
using namespace std;
int main(){
	#define int long long
	int n;
	cin>>n;
	int k, x;
	cin>>k>>x;
	int a[n];
	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;
	}
	if(poz){
		int pref[n+1];
		pref[0] = 0;
		for(int i=1;i<n+1;i++) pref[i] = pref[i-1]+a[i-1];
		int res = 0;
		for(int i=0;i<x;i++){
			res+=pref[k]-pref[i];
		}
		cout<<res<<" ";
		for(int i=1;i<n-k+1;i++){
			res = res+x*a[i+k-1]-a[i-1]-(pref[i+x-1]-pref[i]);
			cout<<res<<" ";
		}
		
	}
	else if(n<4000){
	int pref[n+1];
	pref[0] = 0;
	for(int i=1;i<n+1;i++) pref[i] = pref[i-1]+a[i-1];
	for(int i=0;i<n-k+1;i++){
		int r = k-1+i;
		vector<int> v;
		v.push_back(0);
		for(int j = i+1;j<=r;j++) v.push_back(pref[r+1]-pref[j]);
		sort(v.begin(), v.end());
		int tr = v.size()-1;
		int ostalo = x-1;
		int res = pref[r+1]-pref[i];
		while(ostalo){
			res+=v[tr];
			ostalo--;
			tr--;			
		}
		cout<<res<<" ";
	}
}
else {
		int pref[n+1];
		pref[0] = 0;
		for(int i=1;i<n+1;i++) pref[i] = pref[i-1]+a[i-1];
		int res = pref[k];
		priority_queue<int> q;
		for(int i=1;i<k;i++){
			q.push(pref[k]-pref[i]);
		}
		int veliki = pref[k]-pref[1];
		vector<int> v;
		int dodaj = x-1;
		while(dodaj>0){
			int d = q.top();
			res+=d;
			q.pop();
			v.push_back(d);
			dodaj--;
		}
		cout<<res<<" ";
		for(auto u:v) q.push(u);
		for(int i=1;i<n-k+1;i++){
			res = pref[i+k]-pref[i];
			vector<int> dodati;
			dodaj = x-1;
			vector<int> vv;
			bool presli = false;
			while(dodaj>0){
				int d = q.top();
				if(d==veliki && !presli){
					presli = true;
					continue;
				}
				dodati.push_back(d);
				q.pop();
				vv.push_back(d);
				dodaj--;
			}
			for(int j=0;j<vv.size();j++){
				vv[j]+=a[i+k-1];
			}
			vv.push_back(0);
			veliki = pref[i+k]-pref[i+1];
			int najmanji = 1e18;
			for(auto u:vv) najmanji = min(najmanji, u);
			presli = false;
			for(int j=0;j<vv.size();j++){
				if(!presli && vv[j] == najmanji){
					presli  = true;
					continue;
				}
				else{
					res+=vv[j];	
				}
			}
			cout<<res<<" ";
		}
		/*for(int i=1;i<n-k+1;i++){	
			m = max(m1+a[i+k-1], (long long)0); 
			res = pref[i+k]-pref[i]+m;
			cout<<res<<" ";                
		}*/
	}
}