#include <bits/stdc++.h>
using namespace std;
int n, t;
double c;
int a[1000006];
int main() {
  scanf("%d%d%lf", &n, &t, &c);
  for (int(i) = (0); i < (n); ++(i)) scanf("%d", &a[i]);
  int m, p, l = 0;
  double mean = 0, real = 0;
  scanf("%d", &m);
  for (int(i) = (0); i < (m); ++(i)) {
    scanf("%d", &p);
    for (; l < p; l++) {
      mean = (mean + a[l]) / c;
      real += a[l];
      if (l >= t) real -= a[l - t];
    }
    printf("%.10lf %.10lf %.10lf\n", real / t, mean / t, abs(mean / real - 1));
  }
  return 0;
}
