#include <bits/stdc++.h>
using namespace std;
long long a, n, b, bt, mn;
int main() {
  cin >> n >> a >> b;
  while (n--) {
    cin >> bt;
    mn = bt * a / b;
    cout << bt - (mn * b + a - 1) / a;
    if (n)
      cout << " ";
    else
      cout << endl;
  }
  return 0;
}
