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