#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
const double eps = 1e-10;
const int MAXN = 1000010;
int n, a, b;
int main() {
  scanf("%d%d%d", &n, &a, &b);
  int p = 0;
  while (n--) {
    int x;
    scanf("%d", &x);
    if (p) printf(" ");
    p = 1;
    cout << 1LL * x * a % b / a;
  }
  puts("");
  return 0;
}
