#include <bits/stdc++.h>
using namespace std;
double a[300000], r[300000], mean[300000];
int main() {
  int n, k, m;
  double t, c;
  cin >> n >> t >> c;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    r[i] = a[i];
    if (i > 0) {
      r[i] += r[i - 1];
      mean[i] = mean[i - 1];
    }
    mean[i] = (mean[i] + (a[i] / t)) / c;
    if (i - t >= 0) {
      r[i] -= a[i - (int)t];
    }
  }
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> k;
    --k;
    printf("%.6lf %.6lf %.6lf\n", r[k] / t, mean[k],
           fabs(((r[k] / t) - mean[k]) / (r[k] / t)));
  }
  return 0;
}
