#include <bits/stdc++.h>
using namespace std;
const int MAX_N = (int)2e5 + 1;
long long sum[MAX_N] = {};
double mean[MAX_N] = {};
int main() {
  int n, t, x;
  double c;
  cin >> n >> t >> c;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    sum[i] = sum[i - 1] + x;
    mean[i] = (mean[i - 1] + 1.0 * x / t) / c;
  }
  int m, p;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> p;
    double real = 1.0 * (sum[p] - sum[p - t]) / t;
    printf("%.6lf %.6lf %.6lf\n", real, mean[p], fabs(mean[p] - real) / real);
  }
  return 0;
}
