#include <bits/stdc++.h>
using namespace std;
long long a[200001];
long long part[200001];
long long q[200001];
long double mean[200001];
int main() {
  int n, t;
  long double c;
  cin >> n >> t >> c;
  part[0] = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    part[i] = part[i - 1] + a[i];
  }
  mean[0] = 0;
  for (int i = 1; i <= n; ++i) {
    mean[i] = (mean[i - 1] + a[i] / (long double)t) / c;
  }
  int m;
  cin >> m;
  cout.precision(14);
  for (int i = 1; i <= m; ++i) {
    int q;
    scanf("%d", &q);
    long double real = (part[q] - part[q - t]) / (long double)t;
    long double approx = mean[q];
    long double error = fabs(approx - real) / real;
    cout << real << " " << approx << " " << error << endl;
  }
  return 0;
}
