#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long tek, a, b, deneg, kolvo, tekrez;
  scanf("%d %I64d %I64d", &n, &a, &b);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &tek);
    deneg = tek * a / b;
    kolvo = deneg * b / a;
    while (kolvo * a / b < deneg) kolvo++;
    tekrez = tek - kolvo;
    printf("%I64d ", tekrez);
  }
  return 0;
}
