#include <bits/stdc++.h>
using namespace std;
const int maxn = 123456;
int n, a, b, ai[maxn];
void init() {
  for (int i = 1; i <= n; i++) scanf("%d", &ai[i]);
}
void DYGANDQYM() {
  bool first = 1;
  for (int i = 1; i <= n; i++) {
    if (!first) printf(" ");
    first = 0;
    int M = (((long long)(ai[i])) * a) % b;
    printf("%d", M / a);
  }
  printf("\n");
}
int main() {
  while (scanf("%d%d%d", &n, &a, &b) != EOF) {
    init();
    DYGANDQYM();
  }
  return 0;
}
