#include <bits/stdc++.h>
using namespace std;
int i, n, T, m, x;
double c, mn[500000], sas[500000], s[500000], a[500000], mean;
double module(double x) {
  if (x < 0)
    return -x;
  else
    return x;
}
int main() {
  cin >> n >> T >> c;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    mean = (mean + a[i] / (double)T) / c;
    mn[i] = mean;
    s[i] = s[i - 1] + a[i];
    sas[i] = (s[i] - s[max(0, i - T)]) / T;
  }
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> x;
    printf("%.6f %.6f %.6f \n", sas[x], mn[x], module(sas[x] - mn[x]) / sas[x]);
  }
}
