#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n, m, a, b;
  while (cin >> n >> a >> b) {
    unsigned long long array[n];
    for (long i = 0; i < n; i++) {
      cin >> m;
      array[i] = ((m * a) % b) / a;
    }
    for (long i = 0; i < n; i++) {
      cout << array[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
