#include <bits/stdc++.h>
using namespace std;
int n;
long long a, b, x;
vector<long long> R;
bool check(long long mi, long long piso) {
  long long ret = (mi * a) / b;
  return ret >= piso;
}
long long search(long long fin, long long piso) {
  long long lo = 0, hi = fin;
  if (check(lo, piso)) return lo;
  while (hi - lo > 1) {
    long long mi = (hi + lo) / 2;
    if (check(mi, piso))
      hi = mi;
    else
      lo = mi;
  }
  return hi;
}
int main() {
  cin >> n >> a >> b;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    long long piso = (x * a) / b;
    long long r = search(x, piso);
    R.push_back(x - r);
  }
  for (int i = 0; i < n; ++i) {
    if (i == 0)
      cout << R[i];
    else
      cout << " " << R[i];
  }
  puts("");
}
