#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  double c;
  cin >> n >> t >> c;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int m;
  cin >> m;
  int p[m];
  for (int i = 0; i < m; i++) cin >> p[i];
  double error = 0;
  double real[n + t - 1];
  real[0] = 0;
  for (int i = 0; i < t; i++) real[0] += a[i];
  for (int i = t; i < n; i++) real[i - t + 1] = real[i - t] + a[i] - a[i - t];
  for (int i = 0; i < n - t + 1; i++) real[i] /= t;
  double mean[n + 1];
  mean[0] = 0;
  for (int i = 1; i < n + 1; i++)
    mean[i] = (mean[i - 1] + (double)a[i - 1] / t) / c;
  for (int i = 0; i < m; i++) {
    error = mean[p[i]] - real[p[i] - t];
    if (error >= 0)
      error /= real[p[i] - t];
    else
      error /= -real[p[i] - t];
    cout << fixed << setprecision(6) << real[p[i] - t] << " " << mean[p[i]]
         << " " << error << "\n";
  }
  return 0;
}
