#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, i, j, T;
  double c, er, a[200001], ree[200001], app[200001];
  cin >> n >> T >> c;
  app[0] = ree[0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    ree[i] += ree[i - 1] + a[i];
    app[i] = (app[i - 1] + a[i] / T) / c;
  }
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> x;
    er =
        (abs(app[x] - (ree[x] - ree[x - T]) / T)) / ((ree[x] - ree[x - T]) / T);
    printf("%.6f %.6f %.6f\n", (ree[x] - ree[x - T]) / T, app[x], er);
  }
}
