#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a, b, i, x, t, rem;
  cin >> n >> a >> b;
  for (i = 0; i < n; i++) {
    cin >> x;
    t = (x * a) % b;
    if (t / a >= 1)
      rem = t / a;
    else
      rem = 0;
    cout << rem << " ";
  }
  return 0;
}
