#include <bits/stdc++.h>
using namespace std;
double v[1000001];
long long s[1000001];
int main() {
  long long w, a, b;
  cin >> w >> a >> b;
  for (long long i = 0; i < w; i++) cin >> v[i];
  for (long long i = 0; i < w; i++) {
    long long temp = floor((v[i] * a) / (double)b);
    long long tokens = ceil((temp * b) / (double)a);
    s[i] = v[i] - tokens;
  }
  for (long long i = 0; i < w; i++) cout << s[i] << " ";
  return 0;
}
