#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T x, T y) {
  while (y > 0) {
    x %= y;
    swap(x, y);
  }
  return x;
}
template <class _T>
inline _T sqr(const _T &x) {
  return x * x;
}
const long double PI = 3.1415926535897932384626433832795L;
inline int nxt() {
  int a;
  scanf("%d", &a);
  return a;
}
void solve() {
  int n = nxt();
  int t = nxt();
  double c;
  scanf("%lf", &c);
  int a[n];
  for (int i = 0; i < n; ++i) {
    a[i] = nxt();
  }
  long long s[n + 1];
  s[0] = 0;
  for (int i = 0; i < n; ++i) {
    s[i + 1] = s[i] + a[i];
  }
  double approx[n + 1];
  approx[0] = 0;
  for (int i = 0; i < n; ++i) {
    approx[i + 1] = (approx[i] + a[i] / (double)t) / c;
  }
  double real[n + 1];
  for (int i = t; i <= n; ++i) {
    real[i] = (s[i] - s[i - t]) / (double)t;
  }
  int m = nxt();
  cout << setprecision(6) << fixed;
  for (int i = 0; i < m; ++i) {
    int p = nxt();
    printf("%.6f %.6f %.6f\n", real[p], approx[p],
           abs(approx[p] - real[p]) / real[p]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
