#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a, b, max_dollars, min_tokens, n_tokens;
  string raw_input;
  cin >> n >> a >> b;
  vector<string> tokens(n);
  for (int i = 0; i < n; i++) cin >> tokens[i];
  for (int i = 0; i < n; i++) {
    n_tokens = stoll(tokens[i]);
    max_dollars = n_tokens * a / b;
    if (stoll(tokens[i]) * a % b != 0) {
      min_tokens = ceil((max_dollars * 1.0) * b / a);
      cout << n_tokens - min_tokens << ' ';
    } else {
      cout << 0 << ' ';
    }
  }
  return 0;
}
