#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll ceeel(ll n, ll a) {
  if (n % a == 0) return n / a;
  return n / a + 1;
}
void solve() {
  ll n, aa, b;
  cin >> n >> aa >> b;
  vll a(n, 0);
  for (ll i = (0); i < (n); i++) cin >> a[i];
  vll tmp = a;
  ll ans = 0;
  for (ll i = (0); i < (n); i++) {
    a[i] = (a[i] * aa) / b;
  }
  for (ll i = (0); i < (n); i++) {
    a[i] *= b;
    a[i] = ceeel(a[i], aa);
  }
  for (ll i = (0); i < (n); i++) cout << tmp[i] - a[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
