#include <bits/stdc++.h>

using namespace std;

#define ll long long
const int INF=1e9;
const ll LINF=1e18;
#define kec first.second
#define dva first.fi
#define idx second
#define fi first
#define se second
#define Blok pair<pair<long long,long long>,int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
#define endl "\n"
#define pb push_back

void PRINT(int x) {cerr << x;}
void PRINT(ll x) {cerr << x;}
void PRINT(double x) {cerr << x;}
void PRINT(char x) {cerr << '\'' << x << '\'';}
void PRINT(string x) {cerr << '\"' << x << '\"';}
void PRINT(bool x) {cerr << (x ? "true" : "false");}

template<typename T,typename V>
void PRINT(pair<T,V>& x){
    cerr<<"{";
    PRINT(x.fi);
    cerr<<",";
    PRINT(x.se);
    cerr<<"}";
}
template<typename T>
void PRINT(T &x){
    int id=0;
    cerr<<"{";
    for(auto _i:x){
        cerr<<(id++ ? "," : "");
        PRINT(_i);
    }
    cerr<<"}";
}
void _PRINT(){
    cerr<<"]\n";
}
template<typename Head,typename... Tail>
void _PRINT(Head h,Tail... t){
    PRINT(h);
    if(sizeof...(t)) cerr<<", ";
    _PRINT(t...);
}

#define Debug(x...) cerr<<"["<<#x<<"]=["; _PRINT(x)

const int mxN=2e5;
ll A[mxN+2];
ll suf[mxN+2];
ll pref[mxN+2];
ll seg[4*mxN+1];

void Init(int node,int l,int r){
    if(l==r){
        seg[node]=suf[l];
        return;
    }
    Init(2*node,l,mid);
    Init(2*node+1,mid+1,r);
    seg[node]=max(seg[2*node],seg[2*node+1]);
}

ll Query(int node,int l,int r,int L,int R){
    if(L>R) return 0;
    if(L<=l && r<=R){
        return seg[node];
    }
    ll res=0;
    if(L<=mid) res=max(res,Query(2*node,l,mid,L,R));
    if(R>mid) res=max(res,Query(2*node+1,mid+1,r,L,R));
    return res;
}

void Solve(){
    int N,K,X; cin>>N>>K>>X;
    if(X!=2) exit(0);
    for(int i=1;i<=N;i++){
        cin>>A[i];
    }
    for(int i=1;i<=N;i++) pref[i]=pref[i-1]+A[i];
    for(int i=N;i>=1;i--) suf[i]=suf[i+1]+A[i];

    Init(1,1,N);
    for(int l=1;l<=N-K+1;l++){
        int r=l+K-1;
        ll res=pref[r]-pref[l-1];
        res=max(res,res+(Query(1,1,N,l+1,r)-suf[r+1]));
        cout<<res<<" ";
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; t=1; //cin>>t;
    while(t--){
        Solve();
    }
    return 0;
}