#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long rem = a % b;
    a = b;
    b = rem;
  }
  return a;
}
int main() {
  long long n, a, b;
  cin >> n >> a >> b;
  long long tem;
  for (int i = 0; i < n; i++) {
    cin >> tem;
    long long res1 = (tem * a) / b;
    long long res;
    res1 = res1 * b;
    res = (tem * a - res1) / a;
    if (i < n - 1)
      cout << res << " ";
    else
      cout << res << endl;
  }
  return 0;
}
