#include <bits/stdc++.h>
using namespace std;
int M, N, len, i, uk;
double Real[200100];
double Mean[200100];
double b[200100];
long long a[200100];
long long f[200100];
int Query[200100];
double c;
long long Sum(int L, int R) { return f[R] - f[L - 1]; }
int main() {
  scanf("%d%d%lf", &N, &len, &c);
  for (i = 1; i <= N; i++) {
    scanf("%lld", &a[i]);
    f[i] = f[i - 1] + a[i];
  }
  scanf("%d", &M);
  for (i = 1; i <= M; i++) scanf("%d", &Query[i]);
  for (i = 1; i <= M; i++)
    Real[i] = 1.0 * Sum(Query[i] - len + 1, Query[i]) / len;
  uk = 1;
  b[0] = 0.0;
  for (i = 1; i <= N; i++) b[i] = (1.0 * b[i - 1] + 1.0 * a[i] / len) / c;
  for (i = 1; i <= M; i++) Mean[i] = b[Query[i]];
  for (i = 1; i <= M; i++) {
    printf("%.06lf %.06lf %.06lf\n", Real[i], Mean[i],
           fabs(Real[i] - Mean[i]) / Real[i]);
  }
  return 0;
}
