#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
vector<int> primes;
bool prime[N + 1];
long long getprimepow(long long n, long long p) {
  long long pow = 0;
  for (long long i = p; i <= n; i *= p) {
    pow += n / i;
  }
  return pow;
}
void sieve() {
  prime[1] = 1;
  prime[0] = 1;
  for (int i = 4; i <= N; i += 2) prime[i] = 1;
  for (int i = 3; i * i <= N; i += 2) {
    for (int j = i + i; j <= N; j += i) prime[j] = 1;
  }
  primes.push_back(2);
  for (int i = 3; i <= N; i += 2) {
    if (!prime[i]) primes.push_back(i);
  }
}
long long getfact(int n) {
  long long cnt = 0, k = n;
  for (int i = 0; (i < (int)(primes.size())) && primes[i] <= k; i++) {
    while (n % primes[i] == 0) {
      n = n / primes[i];
      cnt++;
    }
  }
  if (n > 1) {
    cnt++;
  }
  return cnt;
}
int fun(vector<long long> a, long long i, long long n) {
  long long sum = 0;
  long long pw = 1;
  for (int j = 0; j < (int)(a.size()); j++) {
    sum = (sum + (a[j]) * (pw)) % n;
    pw = (i * pw) % n;
  }
  return sum;
}
bool can(long long x, long long n) {
  for (int i = 1; i <= x; i++) {
    if (n % x == 1) {
      n -= n / x;
      n--;
    } else
      return 0;
  }
  if (n % x == 0) return 1;
  return 0;
}
vector<int> todecimal(int n) {
  vector<int> v;
  while (n) {
    v.push_back(n % 2);
    n = n / 2;
  }
  return v;
}
int binpow(int n) {
  int res = 1, a = 2;
  while (n) {
    if (n & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    n >>= 1;
  }
  return res;
}
int axisx[] = {-1, 0, 0, 1};
int axisy[] = {0, -1, 1, 0};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, a, b;
  cin >> n >> a >> b;
  vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < n; i++) {
    long long v = (a * x[i]) / b;
    long long l = 0, r = x[i], m = 0, ans = v;
    while (l <= r) {
      m = (l + r) / 2;
      if ((m * a) / b == v) {
        ans = m;
        r = m - 1;
      } else {
        l = m + 1;
      }
    }
    cout << x[i] - ans << " ";
  }
  cout << '\n';
}
