#include <bits/stdc++.h>
int main() {
  unsigned long long int n, T;
  long double c;
  std::cin >> n >> T >> c;
  unsigned int *a = new unsigned int[n];
  for (unsigned int i = 0; i < n; i++) {
    std::scanf("%u", &a[i]);
  }
  unsigned long long int sum = 0;
  long double real, approx, error, mean = 0.0L;
  for (unsigned int i = 0; i < T; i++) {
    sum += a[i];
    mean = (mean + (long double)a[i] / (long double)T) / c;
  }
  unsigned long long int step = T;
  unsigned long long int m;
  std::scanf("%I64u", &m);
  std::cout << std::fixed << std::setprecision(6);
  for (unsigned int i = 0; i < m; i++) {
    unsigned long long int p;
    std::scanf("%I64u", &p);
    while (step < p) {
      sum -= (unsigned long long int)a[step - T];
      sum += (unsigned long long int)a[step];
      mean = (mean + (long double)a[step] / (long double)T) / c;
      step++;
    }
    real = (long double)sum / (long double)T;
    approx = mean;
    error = std::fabs(approx - real) / real;
    std::cout << real << ' ' << approx << ' ' << error << std::endl;
  }
  delete[] a;
  return 0;
}
