#include <bits/stdc++.h>
using namespace std;
int n, t, q;
double c;
int a[200000];
double r[200000], appr[200000];
int main() {
  scanf("%d%d%lf", &n, &t, &c);
  for (int i = 0; i < (int)(n); ++i) scanf("%d", a + i);
  double sum = 0;
  for (int i = 0; i < (int)(t); ++i) sum += a[i];
  r[t - 1] = sum;
  for (int i = t; i < n; ++i) {
    sum += a[i] - a[i - t];
    r[i] = sum;
  }
  for (int i = 0; i < (int)(n); ++i) r[i] /= t;
  double mean = 0;
  for (int i = 0; i < (int)(n); ++i) {
    mean = (mean + (double)a[i] / t) / c;
    appr[i] = mean;
  }
  scanf("%d", &q);
  for (int query = 0; query < (int)(q); ++query) {
    int p;
    scanf("%d", &p), --p;
    printf("%.9f %.9f %.9f\n", r[p], appr[p], abs(r[p] - appr[p]) / r[p]);
  }
  return 0;
}
