#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, a, b;
  cin >> n >> a >> b;
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    long long x;
    cin >> x;
    long long t = x * a / b;
    long long l = 0, r = x;
    while (l < r) {
      long long m = l + (r - l) / 2;
      long long tt = m * a / b;
      if (tt == t)
        r = m;
      else
        l = m + 1;
    }
    cout << x - l << " ";
  }
  return 0;
}
