#include <bits/stdc++.h>
using namespace std;
bool moments[200000];
int main() {
  int n, T;
  double c;
  cin >> n >> T >> c;
  vector<int> requests(n);
  vector<double> approxVec(n);
  double mean = 0.0;
  for (int t = 0; t < n; ++t) {
    cin >> requests[t];
    mean = (mean + 1.0L * requests[t] / T) / c;
    approxVec[t] = mean;
  }
  int m;
  cin >> m;
  int dummy = -1;
  for (int i = 0; i < m; ++i) {
    cin >> dummy;
    moments[dummy - 1] = true;
  }
  double sumFour = 0.0;
  double temp;
  for (int i = 0; i < n; ++i) {
    sumFour += requests[i];
    if (i - T >= 0) sumFour -= requests[i - T];
    if (moments[i]) {
      temp = sumFour / T;
      printf("%.6f %.6f %.6f\n", temp, approxVec[i],
             std::abs(approxVec[i] - temp) / temp);
    }
  }
}
