#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  long double c;
  cin >> c;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) scanf("%d", &v[i]);
  int m;
  cin >> m;
  int id = t - 1;
  long double curr = 0;
  for (int i = 0; i <= id; ++i) curr += (long double)v[i] / t;
  long double mean = 0;
  for (int i = 0; i <= id; ++i) mean = (mean + (long double)v[i] / t) / c;
  for (int i = 0; i < m; ++i) {
    int p;
    scanf("%d", &p);
    --p;
    while (id < p) {
      ++id;
      curr += (long double)v[id] / t;
      curr -= (long double)v[id - t] / t;
      mean = (mean + (long double)v[id] / t) / c;
    }
    printf("%.10Lf ", curr);
    printf("%.10Lf ", mean);
    printf("%.10Lf\n", abs(mean - curr) / curr);
  }
}
