#include <bits/stdc++.h>
using namespace std;
long long int arr[100005];
int main() {
  long long int n, a, b, x, val, pos;
  cin >> n >> a >> b;
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    long long int val = x * a;
    long long int t = val / b;
    long long int tb = t * b;
    long long int bad = ceil((long double)tb / a);
    cout << x - bad << endl;
  }
}
