#include <bits/stdc++.h>
using namespace std;
const int MaxN = 200005;
const double eps = 1e-7;
const double DINF = 1e100;
const int INF = 1000000006;
const long long LINF = 1000000000000000005ll;
int n, a, b;
long long v;
int main() {
  cin >> n >> a >> b;
  for (int i = 0; i < n; ++i) {
    cin >> v;
    long long zz = (v * a % b) / (long long)a;
    cout << zz;
    if (i < n - 1) cout << " ";
  }
  cout << endl;
  return 0;
}
