#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b;
  cin >> n >> a >> b;
  for (long long count = 1; count <= n; count++) {
    long long w;
    cin >> w;
    long long rem = w * a % b;
    cout << rem / a << ((count == n) ? "\n" : " ");
  }
}
