#include <bits/stdc++.h>
using namespace std;
int main() {
  double n, t, m, buf;
  double c;
  cin >> n >> t >> c;
  vector<double> input;
  for (int j = 0; j < n; ++j) {
    cin >> buf;
    input.push_back(buf);
  }
  cin >> m;
  int time = 0;
  long long bufer = 0;
  double mean = 0;
  int point = 0;
  vector<int> times;
  for (int j = 0; j < m; ++j) {
    cin >> buf;
    times.push_back(buf - 1);
  }
  for (int j = 0; j < n; ++j) {
    if (j >= t) {
      bufer -= input[j - t];
    }
    bufer += input[j];
    mean = (mean + (input[j] / t)) / c;
    if (j == times[point]) {
      double tot_dis = (double)bufer / t;
      cout << fixed << setprecision(8) << tot_dis << ' ' << fixed
           << setprecision(8) << mean << ' ' << fixed << setprecision(8)
           << abs(mean - tot_dis) / tot_dis << endl;
      ++point;
    }
  }
  return 0;
}
