#include <bits/stdc++.h>
const long long inf = 1000000000000000000;
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long x = (a / gcd(a, b)) * b;
  return x;
}
long long power(long long x, long long n, long long m = inf) {
  if (x == 0) {
    return 0;
  }
  if (n == 0) {
    return 1;
  }
  long long ans;
  if (n % 2 == 0) {
    long long smallAns = power(x, n / 2, m);
    ans = (smallAns * smallAns) % m;
  } else {
    long long smallAns = power(x, n - 1, m);
    ans = x;
    ans = (ans * smallAns) % m;
  }
  return (ans + m) % m;
}
bool isprime(int n) {
  if (n == 2) {
    return true;
  } else if (n % 2 == 0) {
    return false;
  } else {
    for (int i = 3; i * i <= n; i += 2) {
      if (n % i == 0) {
        return false;
      }
    }
    return true;
  }
}
int solve() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, a, b;
  cin >> n >> a >> b;
  long long t[n];
  for (long long i = 0; i < n; ++i) {
    long long e;
    cin >> e;
    long long temp = e * a;
    temp = temp % b;
    t[i] = temp / a;
  }
  for (auto i : t) {
    cout << i << " ";
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
