#include <bits/stdc++.h>
using namespace std;
int a[1 << 18];
long long sum[1 << 18];
int p[1 << 18];
int n, T, m;
double c;
void Calc() {
  double mean = 0.0;
  for (int i = 0, j = 0; i < n && j < m; i++) {
    mean = (mean + (a[i] + .0) / T) / c;
    if (i == p[j] - 1) {
      double real = (.0 + sum[i + 1] - sum[i - T + 1]) / T;
      printf("%.9lf ", real);
      printf("%.9lf ", mean);
      printf("%.9lf\n", fabs(real - mean) / real);
      j++;
    }
  }
}
int main() {
  scanf("%d%d%lf", &n, &T, &c);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum[i + 1] = sum[i] + a[i];
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) scanf("%d", &p[i]);
  Calc();
  return 0;
}
