#include <bits/stdc++.h>
using namespace std;
long long a, b, num;
long long good(long long test) {
  long long temp = (num * a) / b;
  long long com = (test * a) / b;
  return temp == com;
}
long long binary() {
  long long low = 0;
  long long high = num;
  long long best;
  long long mid;
  while (low <= high) {
    mid = (low + high) >> 1;
    if (good(mid)) {
      best = mid;
      high = mid - 1;
    } else
      low = mid + 1;
  }
  return best;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n >> a >> b;
  for (int i = 0; i < n; ++i) {
    cin >> num;
    if (i != 0) cout << ' ';
    cout << num - binary();
  }
  return 0;
}
