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