#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  unsigned long long n, a, b, t;
  cin >> n >> a >> b;
  for (unsigned long long i = 0; i < n; i++) {
    cin >> t;
    cout << ((t * a) - ((t * a) / b) * b) / a << ' ';
  }
  return 0;
}
