#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(const T& a) {
  return a < 0 ? -a : a;
}
template <class T>
T sqr(const T& a) {
  return a * a;
}
int main() {
  int n, T;
  double c;
  cin >> n >> T >> c;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  long long realSum = 0;
  double approx = 0.0;
  for (int i = 0; i < T; ++i) {
    realSum += a[i];
    approx = (approx + ((double)a[i]) / T) / c;
  }
  int curT = T;
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    int p;
    scanf("%d", &p);
    while (curT < p) {
      realSum += a[curT] - a[curT - T];
      approx = (approx + ((double)a[curT]) / T) / c;
      ++curT;
    }
    double real = ((double)realSum) / T;
    double error = (real - approx) / real;
    if (error < 0) error = -error;
    printf("%.10lf %.10lf %.10lf\n", real, approx, error);
  }
  return 0;
}
