#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  double c;
  cin >> n >> t >> c;
  vector<long long> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  vector<double> mid(n);
  vector<long long> sum(n + 1);
  sum[0] = 0;
  mid[0] = (double)v[0] / ((double)t * c);
  for (int i = 1; i < n; ++i) {
    mid[i] = (mid[i - 1] + (double)v[i] / ((double)t)) / c;
    sum[i] = sum[i - 1] + v[i - 1];
  }
  sum[n] = sum[n - 1] + v[n - 1];
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int p;
    cin >> p;
    double real = ((double)sum[p] - (double)sum[p - t]) / ((double)t);
    double approx = mid[p - 1];
    double err = fabs(approx - real) / real;
    printf("%.6lf %.6lf %.6lf\n", real, approx, err);
  }
  return 0;
}
