#include <bits/stdc++.h>
using namespace std;
int n;
long double T, c;
int a[200001];
long double b[200001];
long double b2[200001];
int m;
int p[200001];
int main() {
  cin >> n >> T >> c;
  long long int tmpSum = 0;
  int first = (int)-T;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    tmpSum += a[i];
    if (first < 0) {
      b[i] = (long double)tmpSum / T;
    } else {
      tmpSum -= a[first];
      b[i] = (long double)tmpSum / T;
    }
    first++;
    if (i != 0) {
      b2[i] = (b2[i - 1] + ((long double)a[i] / T)) / c;
    } else {
      b2[i] = ((long double)a[i] / T) / c;
    }
  }
  cin >> m;
  for (int i = 0; i < m; ++i) cin >> p[i];
  long double f, s;
  for (int i = 0; i < m; ++i) {
    f = b[p[i] - 1];
    s = b2[p[i] - 1];
    printf("%.6f %.6f %.6f\n", f, s, abs(f - s) / f);
  }
  return 0;
}
