#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
const double eps = 1e-10;
const int MAXN = 1000010;
long long n, a, b;
int main() {
  int p = 0;
  cin >> n >> a >> b;
  while (n--) {
    long long x, y, z;
    cin >> x;
    y = x * a / b;
    if (!y) {
      if (p) printf(" ");
      p = 1;
      cout << x;
      continue;
    }
    long long ll = 1, rr = x;
    while (ll <= rr) {
      long long mm = (ll + rr) >> 1;
      if (mm * a / b >= y)
        rr = mm - 1;
      else
        ll = mm + 1;
    }
    if (p) printf(" ");
    p = 1;
    cout << x - ll;
  }
  puts("");
  return 0;
}
