#include <bits/stdc++.h>
using namespace std;
long long int l[100005];
long long int ans[100005];
int n, a, b;
long long int key;
long long int gcd(long long int x, long long int y) {
  if (x < y) {
    long long int tp = x;
    x = y;
    y = tp;
  }
  while (x % y != 0) {
    x = x % y;
    long long int tp = x;
    x = y;
    y = tp;
  }
  return y;
}
void Solve() {
  for (int i = 1; i <= n; i++) {
    long long int t = l[i] * a / b;
    ans[i] = ((l[i] * a) - t * b) / a;
  }
}
int main() {
  while (scanf("%d%d%d", &n, &a, &b) != EOF) {
    for (int i = 1; i <= n; i++) cin >> l[i];
    Solve();
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
    printf("\n");
  }
}
