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