#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  long long int n, a, b, in;
  cin >> n >> a >> b;
  for (int i = 0; i < n; i++) {
    cin >> in;
    in = ((in * a) % b) / a;
    cout << in << " ";
  }
  cout << endl;
}
