#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned n, T;
  double c;
  cin >> n >> T >> c;
  int *arr = new int[T + 1];
  int nmT = n - T;
  double *real = new double[nmT + 1];
  double *approx = new double[nmT + 1];
  long long int sum = 0;
  double mean = 0.0;
  for (int i = 0; i < T; i++) {
    cin >> arr[i];
    sum += arr[i];
    mean = (mean + (double)arr[i] / T) / c;
  }
  real[0] = (double)sum / T;
  approx[0] = mean;
  int temp;
  for (int i = T; i < n; i++) {
    cin >> temp;
    sum += temp - arr[i % T];
    mean = (mean + (double)temp / T) / c;
    arr[i % T] = temp;
    real[i - T + 1] = (double)sum / T;
    approx[i - T + 1] = mean;
  }
  int m;
  cout << fixed << setprecision(6);
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> temp;
    cout << real[temp - T] << " " << approx[temp - T] << " "
         << fabs((approx[temp - T] - real[temp - T])) / real[temp - T] << endl;
  }
  return 0;
}
