#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, m;
  double c;
  scanf("%d%d%lf", &n, &t, &c);
  double real[n + 1], mean[n + 1], sum_a[n + 1];
  real[0] = 0.0;
  mean[0] = 0.0;
  sum_a[0] = 0.0;
  for (int a, i = 1; i <= n; i++) {
    scanf("%d", &a);
    sum_a[i] = sum_a[i - 1] + a;
    if (i >= t) real[i] = (sum_a[i] - sum_a[i - t]) * 1.0 / t;
    mean[i] = (mean[i - 1] + a * 1.0 / t) / c;
  }
  scanf("%d", &m);
  double err;
  for (int p, i = 1; i <= m; i++) {
    scanf("%d", &p);
    err = abs(mean[p] - real[p]) / real[p];
    printf("%.6f %.6f %.6f\n", real[p], mean[p], err);
  }
  return 0;
}
