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