#include <bits/stdc++.h>
using namespace std;
int n;
int m;
double T, c, at[200009];
int p[200009];
double dp[200009] = {0};
double sum = 0, ans[200009];
int k = 1;
int main() {
  scanf("%d%lf%lf", &n, &T, &c);
  for (int i = 1; i < n + 1; i++) scanf("%lf", &at[i]);
  scanf("%d", &m);
  for (int i = 0; i < m; i++) scanf("%d", &p[i]);
  for (int i = 1; i < n + 1; i++) {
    dp[i] = (dp[i - 1] + at[i] / T) / c;
  }
  for (int i = 1; i < n + 1; i++) {
    sum += at[i];
    if (i >= T) {
      ans[i] = sum / T;
      sum -= at[k];
      k++;
    }
  }
  for (int i = 0; i < m; i++) {
    double kx = abs(ans[p[i]] - dp[p[i]]) / ans[p[i]];
    printf("%.6f %.6f %.6f\n", ans[p[i]], dp[p[i]], kx);
  }
  return 0;
}
