#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64777216")
using namespace std;
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double pi = acos(-1.0), eps = 1e-9;
const int INF = 1000 * 1000 * 1000, mod = INF + 7;
long long n, a, b, x[100005], sum;
void prepare(string s) {
  if ((int)s.size() != 0) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
  }
}
long long bin_search(long long l, long long r) {
  long long mid = (l + r) / 2;
  if (mid == l && mid * a / b == sum) return mid;
  if (mid * a / b < sum) return bin_search(mid + 1, r);
  if (mid * a / b >= sum) return bin_search(l, mid);
}
void solve() {
  cin >> n >> a >> b;
  for (int i = 0; i < n; ++i) cin >> x[i];
  for (int i = 0; i < n; ++i) {
    sum = x[i] * a / b;
    long long col = bin_search(0, x[i]);
    cout << x[i] - col << ' ';
  }
}
int main() {
  prepare("");
  solve();
  return 0;
}
