#include <bits/stdc++.h>
long long m[150000];
int main() {
  int n, a, b;
  while (scanf("%d%d%d", &n, &a, &b) != EOF) {
    int i;
    for (i = 0; i < n; i++) scanf("%I64d", &m[i]);
    for (i = 0; i < n; i++) {
      long long c, d;
      c = (m[i] * a) / b;
      d = (c * b) / a;
      if (!((d * a) / b == c)) {
        d++;
      }
      printf("%I64d ", m[i] - d);
    }
    printf("\n");
  }
  return 0;
}
