#include <bits/stdc++.h>
using namespace std;
vector<double> method1(int n, int t, vector<int> &a) {
  vector<double> res(n, 0);
  double ssum = 0;
  for (unsigned int i = 0; i < t; ++i) ssum += a[i];
  res[t - 1] = ssum / t;
  for (unsigned int i = t; i < n; ++i) {
    ssum += a[i];
    ssum -= a[i - t];
    res[i] = ssum / t;
  }
  return res;
}
vector<double> method2(int n, int t, vector<int> &a, double c) {
  vector<double> res(n, 0);
  double smean = 0;
  for (unsigned int i = 0; i < n; ++i) {
    smean = (smean + double(a[i]) / t) / c;
    res[i] = smean;
  }
  return res;
}
int main() {
  int n, t, m;
  double c;
  cin >> n >> t >> c;
  vector<int> a(n, 0);
  for (unsigned int i = 0; i < n; ++i) cin >> a[i];
  cin >> m;
  vector<int> p(m, 0);
  for (unsigned int i = 0; i < m; ++i) cin >> p[i];
  vector<double> mean1 = method1(n, t, a);
  vector<double> mean2 = method2(n, t, a, c);
  for (unsigned int i = 0; i < m; ++i)
    printf("%.06f %.06f %.06f\n", mean1[p[i] - 1], mean2[p[i] - 1],
           abs(mean1[p[i] - 1] - mean2[p[i] - 1]) / mean1[p[i] - 1]);
  return 0;
}
