#include <bits/stdc++.h>
using namespace std;
int go_to_x[4] = {-1, 0, 1, 0};
int go_to_y[4] = {0, 1, 0, -1};
int main() {
  long long n, a, b;
  cin >> n >> a >> b;
  vector<long long> w(n);
  for (int i = 0; i < int(n); i++) {
    cin >> w[i];
  }
  for (int i = 0; i < int(n); i++) {
    long long t = (a * w[i]) % b;
    long long res = t / a;
    cout << res << " ";
  }
  cout << endl;
  return 0;
}
