#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int N, T, M;
double C;
int A[MAXN];
long long pre[MAXN];
double mean[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> T >> C;
  for (int i = 1; i <= N; i++) cin >> A[i];
  for (int i = 1; i <= N; i++) pre[i] = pre[i - 1] + A[i];
  for (int i = 1; i <= N; i++) mean[i] = (mean[i - 1] + (double)A[i] / T) / C;
  cin >> M;
  for (int i = 0, p; i < M; i++) {
    cin >> p;
    double r = (double)(pre[p] - pre[p - T]) / T;
    printf("%.10f %.10f %.10f\n", r, mean[p], abs(mean[p] - r) / r);
  }
  return 0;
}
