#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=1e5+10;
int k,n,m,a[MAXN],b[MAXN];
ll ans[2*MAXN],ans2[2*MAXN];
bool check(int mid){
  int i,x,minb=0,maxb=0;
  for(i=1;i<=k;i++){
    x=(ll)m*a[i]/n;
    if(ans[2*i-1]>ans2[mid]&&ans[2*i]>ans2[mid])return 0;
    if(ans[2*i-1]<=ans2[mid]&&ans[2*i]>ans2[mid]){
	  minb=minb+x;
	  maxb=maxb+x;
	}
	if(ans[2*i-1]>ans2[mid]&&ans[2*i]<=ans2[mid]){
	  minb=minb+x+1;
	  maxb=maxb+x+1;
	}
	if(ans[2*i-1]<=ans2[mid]&&ans[2*i]<=ans2[mid]){
	  minb=minb+x;
	  maxb=maxb+x+1;
	}
  }
  if(minb<=m&&m<=maxb)return 1;
  else return 0;
}
inline int read(){
  int sum=0,f=1;char ch=getchar();
  while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=getchar();
  return f*sum;
}
int main(){
	k=read();n=read();m=read();
	int i,x;
	for(i=1;i<=k;i++){
	  a[i]=read();
	  x=(ll)m*a[i]/n;
	  ans[2*i-1]=abs((ll)n*x-(ll)m*a[i]);
	  ans[2*i]=abs((ll)n*(x+1)-(ll)m*a[i]);
	}
	for(i=1;i<=2*k;i++)ans2[i]=ans[i];
	sort(ans2+1,ans2+2*k+1);
	int l=1,r=2*k,mid;
	while(l<r){
	  mid=(l+r)>>1;
	  if(check(mid))r=mid;
	  else l=mid+1;
	}
	int minb=0;
	for(i=1;i<=k;i++){
      x=(ll)m*a[i]/n;
      if(ans[2*i-1]<=ans2[l]&&ans[2*i]>ans2[l]){
	    minb=minb+x;
	    b[i]=x;
	  }
	  if(ans[2*i-1]>ans2[l]&&ans[2*i]<=ans2[l]){
	    minb=minb+x+1;
	    b[i]=x+1;
	  }
	  if(ans[2*i-1]<=ans2[l]&&ans[2*i]<=ans2[l])minb=minb+x;
    }
    int d=m-minb;
    for(i=1;i<=k;i++){
      x=(ll)m*a[i]/n;
	  if(ans[2*i-1]<=ans2[l]&&ans[2*i]<=ans2[l]){
	    if(d){b[i]=x+1;d--;}
		else b[i]=x;
	  }
	}
	for(i=1;i<=k;i++)printf("%d ",b[i]);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int k, n, m;
    cin >> k >> n >> m;
    ll a[k];
    rep(i, k) {
        cin >> a[i];
    }
    int use = 0;
    priority_queue<pair<ll, ll>> que;
    rep(i, k) {
        ll t = (a[i] * m + n - 1) / n;
        que.emplace(t * n - a[i] * m, i);
        use += t;
    }
    while(use > m) {
        auto p = que.top();
        que.pop();
        p.first -= n;
        que.emplace(p);
        use--;
    }
    ll b[k];
    while (!que.empty()) {
        auto p = que.top();
        que.pop();
        b[p.second] = (p.first + m * a[p.second]) / n;
    }
    rep(i, k) {
        cout << b[i] << endl;
    }
    return 0;
}