#include <bits/stdc++.h>
using namespace std;
long long a[200005];
long long b[200005];
double m[200005];
int main() {
  ios_base::sync_with_stdio(0);
  int n, t;
  double c;
  cin >> n >> t >> c;
  m[0] = 0.0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = a[i] + b[i - 1];
    m[i] = (m[i - 1] + a[i] / (double)t) / c;
  }
  int q;
  cin >> q;
  cout << fixed << setprecision(6);
  for (int z = 1; z <= q; z++) {
    int p;
    cin >> p;
    double ans = (b[p] - b[p - t]) / (double)t;
    cout << ans << " " << m[p] << " " << abs(ans - m[p]) / ans << '\n';
  }
  return 0;
}
