#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e5 + 1;
int n;
long long a, b;
long long x[MXN];
long long bin_search(long long x) {
  long long lo = -1LL, hi = x;
  while (hi - lo > 1) {
    long long mid = (lo + hi) / 2LL;
    if ((mid * a) / b >= (x * a) / b)
      hi = mid;
    else
      lo = mid;
  }
  return x - hi;
}
int main() {
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) cin >> x[i];
  for (int i = 1; i <= n; i++) cout << bin_search(x[i]) << ' ';
  return 0;
}
