#include <bits/stdc++.h>
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 9;
const int OO = INT_MAX;
const int dx[] = {1, -1, 0, 0, 0, 0};
const int dy[] = {0, 0, 1, -1, 0, 0};
const int dz[] = {0, 0, 0, 0, 1, -1};
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, a, b;
  cin >> n >> a >> b;
  for (long long int i = 0; i < n; ++i) {
    long long int w;
    cin >> w;
    long long int ans = (w * a) % b;
    ans /= a;
    cout << ans << " ";
  }
  cout << "" << '\n';
}
