#include <bits/stdc++.h>
using namespace std;
int main() {
  cout << fixed << setprecision(6);
  int n, t;
  double c;
  cin >> n >> t >> c;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<long long> sum(n + 1);
  for (int i = 0; i < n; ++i) {
    sum[i + 1] = sum[i] + a[i];
  }
  vector<double> approx(n + 1);
  for (int i = 0; i < n; ++i) {
    approx[i + 1] = (approx[i] + (double)a[i] / t) / c;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    --x;
    double real = double(sum[x + 1] - sum[x - t + 1]) / t;
    double error = abs(approx[x + 1] - real) / real;
    printf("%f %f %f\n", real, approx[x + 1], error);
  }
}
