#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 100;
double a[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  double T, c;
  cin >> n >> T >> c;
  for (int i = 0; i < n; i++) cin >> a[i + 1];
  vector<double> pref(n + 1, 0);
  for (int i = 1; i <= n; i++) pref[i] = pref[i - 1] + a[i];
  auto go = [&](int p) {
    static int i = 1;
    static double mean = 0.0;
    while (i <= p) {
      mean = (mean + a[i] / T) / c;
      i++;
    }
    return mean;
  };
  int m;
  cin >> m;
  for (int i = 0, p; i < m; i++) {
    cin >> p;
    double re = (pref[p] - pref[p - (int)T]) / T;
    double app = go(p);
    double err = abs(app - re) / re;
    cout << setprecision(6) << fixed << re << " " << app << " " << err << endl;
  }
  return 0;
}
