#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
long long n, m, t;
double c;
long long a[200005];
long long b[200005];
long long x[200005];
double y[200005];
int main() {
  cin >> n >> t >> c;
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  for (int k = 0; k < m; k++) cin >> b[k];
  x[0] = a[0];
  for (int i = 1; i < n; i++) {
    x[i] = x[i - 1] + a[i];
  }
  double mean = 0;
  for (int i = 0; i < n; i++) {
    mean = (mean + a[i] / double(t)) / c;
    y[i] = mean;
  }
  cout.precision(6);
  for (int i = 0; i < m; i++) {
    int ind = b[i] - 1;
    int i1 = ind - t;
    double out = 0;
    if (i1 >= 0)
      out = x[ind] - x[i1];
    else
      out = x[ind];
    out /= double(t);
    printf("%.6lf ", out);
    printf("%.6lf ", y[ind]);
    printf("%.6lf\n", fabs(y[ind] - out) / out);
  }
  return 0;
}
