#include <bits/stdc++.h>
long long a[1000000], p[1000000];
double sum[200000];
int main() {
  long long n, T, m;
  double c, real, mean;
  long long i, k;
  FILE *in = stdin;
  fscanf(in, "%I64d %I64d %lf", &n, &T, &c);
  fgetc(in);
  for (i = 0; i < n; ++i) {
    fscanf(in, "%I64d", &a[i]);
  }
  fgetc(in);
  fscanf(in, "%I64d", &m);
  fgetc(in);
  for (i = 0; i < m; ++i) {
    fscanf(in, "%I64d", &p[i]);
  }
  fgetc(in);
  k = 0;
  mean = 0;
  for (i = 0; i < n; i++) {
    sum[i] = (i - 1 >= 0 ? sum[i - 1] : 0) + a[i];
    mean = (mean + a[i] / (float)T) / c;
    if ((i + 1) == p[k]) {
      real = (sum[i] - ((i - T) >= 0 ? sum[i - T] : 0)) / T;
      printf("%lf %lf %lf\n", real, mean, fabs(mean - real) / real);
      k++;
    }
  }
  return 0;
}
