#include <bits/stdc++.h>
using namespace std;
int main() {
  double c, real, approx, error;
  double mean = 0.0, s = 0.0;
  int t, n, i, j, m, k1 = 0, T;
  cin >> n >> T >> c;
  double *x = new double[n];
  for (i = 0; i < n; ++i) cin >> x[i];
  cin >> m;
  int *y = new int[m];
  for (i = 0; i < m; ++i) cin >> y[i];
  for (j = k1; j < y[0]; ++j) {
    mean = (mean + x[j] / T) / c;
  }
  approx = mean;
  for (j = y[0] - T; j < y[0]; ++j) s += x[j];
  real = s / T;
  error = fabs(approx - real) / real;
  printf("%.6lf %.6lf %.6lf\n", real, approx, error);
  k1 = y[0];
  for (i = 1; i < m; ++i) {
    for (j = k1; j < y[i]; ++j) {
      mean = (mean + x[j] / T) / c;
    }
    approx = mean;
    for (j = y[i - 1]; j < y[i]; ++j) {
      s += x[j];
      s -= x[j - T];
    }
    real = s / T;
    error = fabs(approx - real) / real;
    printf("%.6lf %.6lf %.6lf\n", real, approx, error);
    k1 = y[i];
  }
  return 0;
}
