#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, T, a, m;
  double mean = 0.0;
  double sum = 0.0, c;
  scanf("%d%d%lf", &n, &T, &c);
  double* b1 = new double[n];
  double* b2 = new double[n];
  double* b3 = new double[n];
  for (int i = 0; i < T - 1; i++) {
    scanf("%d", &a);
    sum += a;
    b1[i] = (a * 1.0);
    mean = (mean + (a * 1.0) / T) / c;
  }
  for (int i = T - 1; i < n; i++) {
    scanf("%d", &a);
    b1[i] = (a * 1.0);
    { mean = (mean + (a * 1.0) / T) / c; }
    sum += a;
    if (i - T >= 0) {
      sum -= b1[i - T];
    }
    b2[i] = mean;
    b3[i] = (sum) / T;
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &a);
    printf("%lf %lf %lf\n", b3[a - 1], b2[a - 1],
           abs(b3[a - 1] - b2[a - 1]) / b3[a - 1]);
  }
  return 0;
}
