#include <bits/stdc++.h>
using namespace std;
struct __s {
  __s() {
    if (1) {
      ios_base::Init i;
      cin.sync_with_stdio(0);
      cin.tie(0);
    }
  }
  ~__s() {
    if (!1)
      fprintf(stderr, "Execution time: %.3lf s.\n",
              (double)clock() / CLOCKS_PER_SEC);
    long long n;
    cin >> n;
  }
} __S;
long long n, m;
double t, c;
double a[211111];
double sum, mean;
int main(void) {
  cin >> n >> t >> c;
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> a[i];
  }
  cin >> m;
  long long b = 0;
  for (long long i = 0; i < (long long)(t); i++) {
    sum += a[i];
    mean = (mean + a[i] / t) / c;
    b++;
  }
  for (long long i = 0; i < (long long)(m); i++) {
    long long tt;
    cin >> tt;
    while (b != tt) {
      sum += a[b];
      if (b - t >= 0) sum -= a[b - (long long)t];
      mean = (mean + a[b] / t) / c;
      b++;
    }
    double real = sum / t;
    printf("%.6f %.6f %.6f\n", real, mean, fabs(real - mean) / real);
  }
  return 0;
}
