#include <bits/stdc++.h>
using ll=long long;
using namespace std;

int main()
{
    ll n, k, x;
    cin>>n>>k>>x;
    vector<ll> p(n);
    ll c=1;
    ll s=0;
    ll S=0;
    ll pon=0;
    bool poz=true;
    for (ll i=0; i<n; i++){
            cin>>p[i];
            if (p[i]<0)poz=false;}
    if (poz){
    for (ll i=0; i<n; i++){
        if (i>k-1) s-=p[i-k]*min(i-k+1, x);
        s+=p[i]*min(x,c);
        c++;
        if (i>=k-1) cout<<s<<" ";
        }}
    else if (x==2){
        while (pon<n-k+1){
        vector<ll>pom(k);
        for (int i=0; i<k; i++){
            pom[i]=p[i+pon];
        }
        pon++;
        ll idx=0;
        ll sum=0;
        for (int i=k-1; i>0;i--){
            if (i==k-1)S+=pom[i];
            s+=pom[i];
            if(s>=S) {S=s; idx=i;}
        }
        if(S<0) cout<<s+pom[0]<<" ";
        s=0;
        if(S>=0){
        for (int i=0; i<idx;i++){
            sum+=pom[i];
        }
        cout<<sum+2*S<<" ";}}
    }
    }