#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a_, b_;
  scanf("%d%d%d", &n, &a_, &b_);
  const long long a = a_;
  const long long b = b_;
  while (n--) {
    int x_;
    scanf("%d", &x_);
    const long long x = x_;
    if (b == 1) {
      printf("0 ");
    } else {
      const long long xa = x * a;
      const long long rem1 = xa % b;
      const long long goal = xa - rem1;
      long long w = goal / a;
      if (w * a != goal) ++w;
      printf("%d ", (int)(x - w));
    }
  }
  return 0;
}
