#include <bits/stdc++.h>
using namespace std;
template <class T>
void max_self(T& a, const T& b) {
  if (a < b) a = b;
}
template <class T>
void min_self(T& a, const T& b) {
  if (a > b) a = b;
}
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long N, a, b, util;
  cin >> N >> a >> b;
  for (int rep = 0; rep < N; ++rep) {
    cin >> util;
    cout << ((util * a) % b) / a << " ";
  }
}
