#include <bits/stdc++.h>
int a[200001];
int main() {
  int n, m, T;
  double c;
  scanf("%d%d%lf", &n, &T, &c);
  double rreal{0};
  double rapprox{0};
  for (auto i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (i < T) {
      rreal += (double)a[i] / (double)T;
      rapprox = (rapprox + (double)a[i] / (double)T) / c;
    }
  }
  int preal = T - 1;
  scanf("%d", &m);
  for (auto j = 0; j < m; j++) {
    int pj;
    scanf("%d", &pj);
    while (preal < pj - 1) {
      preal++;
      rreal = rreal + (-(double)a[preal - T] + (double)a[preal]) / (double)T;
      rapprox = (rapprox + (double)a[preal] / (double)T) / c;
    }
    printf("%.9lf %.9lf %.9lf\n", rreal, rapprox,
           fabs(rreal - rapprox) / rreal);
  }
}
