#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 105000;
int n, t, m;
double c;
int a[MAXN];
queue<int> q;
double sum;
int p[MAXN];
int cur = 1;
double mean;
int main() {
  scanf("%d %d %lf", &n, &t, &c);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) {
    q.push(a[i]);
    sum += a[i];
    if ((int)q.size() > t) {
      sum -= q.front();
      q.pop();
    }
    mean = (mean + 1.0 * a[i] / t) / c;
    if (cur <= m && i == p[cur]) {
      double rm = 1.0 * sum / t;
      printf("%.12lf %.12lf %.12lf\n", rm, mean, abs(rm - mean) / rm);
      cur++;
    }
  }
  return 0;
}
