#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, a, b;
  long long temp;
  cin >> n >> a >> b;
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    temp *= a;
    temp %= b;
    temp /= a;
    cout << temp << " ";
  }
  return 0;
}
