#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, i, a1, b1, y, y1, ans, ans1, ans2, x;
  cin >> n >> a >> b;
  for (i = 1; i <= n; i++) {
    cin >> x;
    y = x * a;
    ans = y % b;
    if (a != 0)
      cout << ans / a << " ";
    else
      cout << x << " ";
  }
  return 0;
}
