#include <bits/stdc++.h>
using namespace std;
const int Max = 202202;
int n, m, T;
double c;
long long a[Max], p[Max];
double mean[Max];
int main() {
  scanf(" %d %d %lf", &n, &T, &c);
  for (int i = 1; i <= n; i++) scanf(" %I64d", &a[i]);
  p[0] = 0;
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] + a[i];
  mean[0] = 0.0;
  double TTT = T * 1.0;
  for (int i = 1; i <= n; i++) mean[i] = (mean[i - 1] + (a[i] * 1.0) / TTT) / c;
  scanf(" %d", &m);
  for (int i = 1; i <= m; i++) {
    int Time;
    scanf(" %d", &Time);
    double reality = p[Time] - p[Time - T];
    reality /= TTT;
    double err = reality - mean[Time];
    if (err < 0) err *= (-1.0);
    err /= reality;
    printf("%0.7lf %0.7lf %0.7lf\n", reality, mean[Time], err);
  }
  return 0;
}
