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