#pragma optimize("s",on)
#include <bits/stdc++.h>
const double eps = 1e-6;
template <int T>
struct fast_io {
char p[T], *p1, *p2, q[T], *q1, *q2;
fast_io() {
p1 = p2 = p, q1 = q, q2 = q + T;
}
char gc() {
return p1 == p2 && (p2 = (p1 = p) + fread(p, 1, T, stdin), p1 == p2) ? EOF : *p1++;
}
void pc(char ch) {
if (q1 == q2) {
fwrite(q, 1, T, stdout);
q1 = q;
}
*q1++ = ch;
}
~fast_io() {
fwrite(q, 1, q1 - q, stdout);
}
};
fast_io<1 << 21> io;
int read() {
int r = 0, neg = 1;
char ch;
do {
ch = io.gc();
if (ch == '-') neg = -1;
} while (ch < 48 || ch > 57);
do r = r * 10 + ch - 48, ch = io.gc(); while (ch >= 48 && ch <= 57);
return r * neg;
}
void write(int x) {
if (x < 0) x = -x, io.pc('-');
if (x >= 10) write(x / 10);
io.pc(48 + x % 10);
}
void output(int x, char ch = ' ') {
write(x);
io.pc(ch);
}
int main() {
std::vector<int> useful_b;
int m, n;
double p;
m = read(), p = read(), n = read();
p /= 100;
std::vector<int> h(n), table(m + 1);
for (int i = 0; i < n; ++i)
h[i] = read();
for (int l = 1, r = 0; l <= m; l = r + 1) {
r = m / (m / l);
table[r] = true;
}
int sc = 0;
double f = 1, g = 1;
std::vector<std::pair<double, int>> pos(m + 1, std::make_pair(-1e18, 0));
static double a[1000005], b[1000005];
auto ins = [&](double val, int b, int i) {
int t = (m / b) * i;
pos[t] = std::max(pos[t], std::make_pair(val, b));
};
auto debug = [&]() {
for (int i = 1; i <= m; ++i)
printf("a[%d] = %.6f, b[%d] = %.6f\n", i, a[i], i, b[i]);
};
double z = (1 - p) / p, z0 = p / (1 - p);
for (int i = 1; i <= m; ++i) {
double lim = i * p;
if (sc < lim) {
++sc;
double _f = f - (1 - p) * g;
double _g = g * lim / sc;
f = _f, g = _g;
}
else {
double _f = f + g * sc * (1 - p) / (i - sc);
double _g = g * (1 - p) * i / (i - sc);
f = _f, g = _g;
}
if (table[i]) {
a[sc] = f, b[sc] = g;
ins(f, i, sc);
double *pa = a + sc, *pb = b + sc;
for (int j = sc - 1; j >= 1; --j) {
double bj = *pb * z * (j + 1) / (i - j);
*--pb = bj;
double aj = *pa + *pb;
*--pa = aj;
if (1 - *pb > eps) {
ins(*pa, i, j);
}
else if (i == m) {
ins(1, i, j);
}
}
pa = a + sc, pb = b + sc;
for (int j = sc + 1; j <= i; ++j) {
double bj = *pb * z0 * (i - j + 1) / j;
double aj = *pa - *pb;
*++pb = bj;
*++pa = aj;
if (*pa >= p)
ins(*pa, i, j);
}
}
}
for (int i = m; i > 0; --i)
pos[i] = std::max(pos[i], pos[i + 1]);
for (int i = 0; i < n; ++i) {
int x = 0, y = 0;
if (h[i] > m) {
x = y = 1;
}
else {
y = pos[h[i]].second;
x = m / y;
}
cout<<x<<y<<endl;
}
}