#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int n, t, m, i, j, temp;
  long double c;
  cin >> n >> t >> c;
  vector<long double> a(n);
  vector<long double> mean;
  vector<long double> real;
  mean.push_back(0);
  real.push_back(0);
  for (i = 0; i < n; i++) {
    cin >> a[i];
    mean.push_back((mean[i] + (a[i] / (long double)t)) / c);
    real.push_back(real[i] + (a[i] / (long double)t));
  }
  cin >> m;
  vector<unsigned long long int> p(m);
  for (i = 0; i < m; i++) cin >> p[i];
  for (i = 0; i < m; i++) {
    cout << fixed << setprecision(6) << (real[p[i]] - real[p[i] - t]) << " "
         << mean[p[i]] << " "
         << (fabs(mean[p[i]] - (real[p[i]] - real[p[i] - t])) /
             (real[p[i]] - real[p[i] - t]))
         << endl;
  }
  return 0;
}
