#include <bits/stdc++.h>
using namespace std;
int i, n, t, aux;
double mean[1000005], b[1000005], c, gmb;
long long sum[1000005];
inline double ABS(double a) { return a < 0 ? -a : a; }
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> t >> c;
  for (i = 1; i <= n; ++i) {
    cin >> aux;
    sum[i] = sum[i - 1] + aux;
    mean[i] = mean[i - 1] + 1.0 * aux / t;
    mean[i] /= c;
  }
  cin >> n;
  cout << setprecision(6) << fixed;
  while (n--) {
    cin >> aux;
    gmb = (double)(sum[aux] - sum[aux - t]) / t;
    cout << gmb << ' ' << mean[aux] << ' ' << ABS(mean[aux] - gmb) / gmb
         << '\n';
  }
  return 0;
}
