#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, k = 1;
  double c, mean = 0.0, ma = 0.0, T, d;
  scanf("%I64d%lf%lf", &n, &T, &c);
  vector<long long> a(n);
  vector<long long> p;
  vector<double> mean1(n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
  }
  scanf("%I64d", &m);
  p.resize(m);
  for (int i = 0; i < m; i++) {
    scanf("%I64d", &p[i]);
  }
  for (int i = 0; i < n; i++) {
    mean = (mean + a[i] / T) / c;
    mean1[i] = mean;
  }
  for (int i = 1; i < n; i++) {
    a[i] += a[i - 1];
  }
  for (int i = 0; i < m; i++) {
    if (p[i] - T - 1 >= 0) {
      ma = (a[p[i] - 1] - a[p[i] - 1 - T]) / T;
    } else
      ma = (a[p[i] - 1]) / T;
    d = abs(mean1[p[i] - 1] - ma) / ma;
    printf("%6lf %6lf %6lf\n", ma, mean1[p[i] - 1], d);
    ma = 0.0;
  }
  return 0;
}
