#include <bits/stdc++.h>
using namespace std;
long long n, a, b, x, t;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    t = x * a / b;
    t *= b;
    t = ceil(t / (a + 0.0));
    cout << x - t << " ";
  }
}
