#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, k, n, a, b, x;
  scanf("%d %d %d", &n, &a, &b);
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    double j = x * 1.0 * a / b;
    double p = (j - (long long int)j) * b * 1.0 / a;
    int d = (int)p;
    if (floor((x - d) * 1.0 * a / b) == floor((x - d - 1) * 1.0 * a / b)) d++;
    printf("%d ", d);
  }
  printf("\n");
  return 0;
}
