#include <bits/stdc++.h>
using namespace std;
double mas[200005];
int n, T, m;
double c;
double Real[200005];
double Appr[200005];
double Errr[200005];
double s;
int main() {
  scanf("%d %d %lf", &n, &T, &c);
  for (int i = 0; i < n; i++) {
    scanf("%lf", &mas[i]);
    s += (i < T) ? mas[i] : 0.0;
  }
  double mean = 0;
  for (int i = 0; i < n; i++) {
    mean = (mean + mas[i] / T) / c;
    Appr[i] = mean;
  }
  Real[T - 1] = s / T;
  Errr[T - 1] = fabs(Real[T - 1] - Appr[T - 1]) / Real[T - 1];
  for (int i = T; i < n; i++) {
    s -= mas[i - T];
    s += mas[i];
    Real[i] = s / T;
    Errr[i] = fabs(Real[i] - Appr[i]) / Real[i];
  }
  scanf("%d", &m);
  for (int i = 0, a; i < m; i++) {
    scanf("%d", &a);
    printf("%.9f %.9f %.9f\n", Real[a - 1], Appr[a - 1], Errr[a - 1]);
  }
  return 0;
}
