#include <bits/stdc++.h>
using namespace std;
long long n, a, b;
long long getMincoins(long long start, long long end, long long val) {
  long long ans = -1, mid;
  while (start <= end) {
    mid = (start + end) / 2;
    if ((mid * a) / b >= val) {
      ans = mid;
      end = mid - 1;
    } else {
      start = mid + 1;
    }
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> a >> b;
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  for (long long i = 0; i < n; i++) {
    long long ans = getMincoins(0, v[i], (v[i] * a) / b);
    cout << v[i] - ans << " ";
  }
  return 0;
};
