#include <bits/stdc++.h>
long long a[200001];
long long q[200001];
using namespace std;
int main() {
  long long n, T, m, time, time2;
  double c;
  double error, approx, real, mean, R;
  cin >> n >> T >> c;
  for (long long i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  scanf("%I64d", &m);
  for (long long i = 1; i <= m; i++) scanf("%I64d", &q[i]);
  for (long long i = 1; i <= m; i++) {
    if (i == 1) {
      real = 0;
      for (long long j = 0; j < T; j++) real += a[q[i] - j];
      R = real;
      real /= T;
      time2 = q[i];
    } else {
      real = R;
      for (long long j = 1; j <= q[i] - time2; j++) {
        real = real + a[time2 + j];
        real = real - a[time2 - T + j];
      }
      R = real;
      real /= T;
      time2 = q[i];
    }
    if (i == 1) {
      mean = 0;
      for (long long k = 1; k <= q[i]; k++) {
        mean += ((double)a[k] / T * 1.0);
        mean /= c;
      }
      time = q[i];
    } else {
      for (long long k = 1; k <= q[i] - time; k++) {
        mean += ((double)a[time + k] / T);
        mean /= c;
      }
      time = q[i];
    }
    error = fabs(mean - real) / real;
    cout << setprecision(6) << fixed << real << " " << mean << " " << error
         << "\n";
  }
}
