#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, t, m;
  double c;
  cin >> n >> t >> c;
  int a[200000];
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  int curt = t;
  long long sum = 0;
  double mean = 0;
  for (int i = 0; i < curt; i++) {
    sum += a[i];
    mean = (mean + (double)a[i] / t) / c;
  }
  for (int i = 0; i < m; i++) {
    int p;
    cin >> p;
    for (int j = curt; j < p; j++) {
      sum += (a[j] - a[j - t]);
      mean = (mean + (double)a[j] / t) / c;
    }
    curt = p;
    double real = (double)sum / t;
    double error = abs(real - mean) / real;
    cout << fixed << setprecision(6) << real << ' ' << mean << ' ' << error
         << '\n';
  }
  return 0;
}
