#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const int N = 1 * 1e5 + 10;
ll res;
void solve() {
  ll n, a, b;
  cin >> n >> a >> b;
  for (int i = 0; i < n; ++i) {
    cin >> res;
    cout << ((res * a) % b) / a << " ";
  }
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  while (t--) {
    solve();
  }
}
