#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 2e5+5;


int n, k, x;
int a[MAXN];
int p[MAXN];
int comp[MAXN], decomp[MAXN];
array<int,2> b[MAXN];

void fdjsigds(){
    for(int i = 0; i <= n; ++i){
        b[i] = {p[i],i};
    }
    sort(b,b+n+1);
    for(int i = 0; i <= n; ++i){
        comp[b[i][0]] = i;
        decomp[i] = b[i][0];
    }
}

array<int,2> sg[4*MAXN];

void update(int x, bool add, int l=0, int r=n, int i=1){
    if(r < x || x < l) return;
    if(l == r){
        if(add) sg[i] = {decomp[x],1};
        else sg[i] = {0,0};
        return;
    }
    int mid = (l+r)/2;
    update(x,add,l,mid,2*i);
    update(x,add,mid+1,r,2*i+1);
    sg[i] = {sg[2*i][0] + sg[2*i+1][0], sg[2*i][1] + sg[2*i+1][1]};
}

int read(int x, int l=0, int r=n, int i=1){
    if(sg[i][1] == x) return sg[i][0];
    int mid = (l+r)/2;
    if(sg[2*i][1] >= x) return read(x,l,mid,2*i);
    else return sg[2*i][0] + read(x-sg[2*i][1],mid+1,r,2*i+1);
}

void solve(){
    cin >> n >> k >> x;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
        p[i] = p[i-1]+a[i];
    }
    fdjsigds();
    for(int i = 1; i <= k; ++i){
        update(comp[p[i]],1);
    }
    cout << x*p[k]-read(x-1)-p[0] << ' ';
    for(int i = 2; i+k-1 <= n; ++i){
        update(comp[p[i-1]],0);
        update(comp[p[i+k-1]],1);
        cout << x*p[i+k-1] - read(x-1) - p[i-1] << ' ';
    }

}



int32_t main(){
    //ios_base::sync_with_stdio(0);cin.tie(0);
    int qqq=1;
    //cin >> qqq;
    while(qqq--)solve();
    return 0;
}