#include <bits/stdc++.h>
using namespace std;
long n, i, j, m, t, g;
double mean[300000], a[300000], r[300000], s[300000], d[300000], c;
double mod(double x) {
  if (x < 0) x *= -1;
  return x;
}
int main() {
  cin >> n >> t >> c;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    s[i] = a[i] + s[i - 1];
  }
  for (i = 1; i <= n; i++) {
    mean[i] = (mean[i - 1] + a[i] / t) / c;
    if (i < t)
      r[i] = s[i] / i;
    else
      r[i] = (s[i] - s[i - t]) / t;
    d[i] = mod(r[i] - mean[i]) / r[i];
  }
  cin >> m;
  for (i = 0; i < m; i++) {
    cin >> g;
    printf("%.5f", r[g]);
    cout << ' ';
    printf("%.5f", mean[g]);
    cout << ' ';
    printf("%.5f", d[g]);
    if (i < m - 1) cout << endl;
  }
}
