#include <bits/stdc++.h>
using namespace std;
double a[200100], b[200100], q[200100];
int main() {
  int n;
  double t;
  double c;
  double mean = 0.0;
  cin >> n >> t >> c;
  cin >> a[0];
  b[0] = a[0];
  q[0] = (a[0] / t) / c;
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    b[i] = b[i - 1] + a[i];
    q[i] = (q[i - 1] + a[i] / t) / c;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int p;
    cin >> p;
    p = p - 1;
    double approx, real;
    approx = q[p];
    int t1 = int(t);
    real = (b[p] - b[p - t1]) / t;
    printf("%.6lf", real);
    cout << " ";
    printf("%.6lf", approx);
    cout << " ";
    printf("%.6lf", abs(approx - real) / real);
    cout << endl;
  }
  return 0;
}
