#include <bits/stdc++.h>
int x[100000];
int main() {
  long long n, a, b, w, z;
  scanf("%lld%lld%lld", &n, &a, &b);
  int i;
  for (i = 0; i < n; i++) {
    scanf("%lld", &x[i]);
    w = x[i] * a / b;
    if (w * b % a == 0)
      z = w * b / a;
    else
      z = w * b / a + 1;
    printf("%lld ", x[i] - z);
  }
  printf("\n");
  return 0;
}
