#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long a, b, c, d;
  cin >> a >> b >> c;
  for (int i = 1; i <= a; i++) {
    cin >> d;
    cout << ((b * d) % c) / b << " ";
  }
  cout << endl;
  return 0;
}
