#include <bits/stdc++.h>
long long n, a, b, w;
int main(int argc, char **argv) {
  scanf("%I64d %I64d %I64d", &n, &a, &b);
  while (n--) {
    scanf("%I64d", &w);
    long long p = (w * a) / b;
    printf("%I64d%s", w - (p * b + a - 1) / a, n == 0 ? "\n" : " ");
  }
  return 0;
}
