#include <bits/stdc++.h>
double a[201000], ans1[201000], ans2[201000], ans3[201000];
int main(void) {
  int n, t;
  double c;
  int m, mm;
  int i;
  double tempd;
  double sum;
  while (scanf("%d %d %lf", &n, &t, &c) != EOF) {
    for (i = 1; i <= n; i++) {
      scanf("%lf", &a[i]);
    }
    sum = 0;
    for (i = 1; i < t; i++) {
      sum += a[i];
    }
    for (i = t; i <= n; i++) {
      sum += a[i];
      ans1[i] = sum / t;
      sum -= a[i - t + 1];
    }
    sum = 0;
    for (i = 1; i < t; i++) {
      sum += a[i];
      sum /= c;
    }
    for (i = t; i <= n; i++) {
      sum += a[i];
      sum /= c;
      ans2[i] = sum / t;
    }
    for (i = t; i <= n; i++) {
      tempd = ans2[i] - ans1[i];
      if (tempd < 0) {
        tempd = -tempd;
      }
      ans3[i] = tempd / ans1[i];
    }
    scanf("%d", &m);
    for (i = 1; i <= m; i++) {
      scanf("%d", &mm);
      printf("%.6f %.6f %.6f\n", ans1[mm], ans2[mm], ans3[mm]);
    }
  }
  return 0;
}
