#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
double b[N];
long long sum[N];
int main() {
  int n, T;
  double c;
  scanf("%d%d%lf", &n, &T, &c);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum[i] = sum[i - 1] + a[i];
    b[i] = (b[i - 1] + a[i] * 1.0 / T) / c;
  }
  int m;
  scanf("%d", &m);
  while (m--) {
    int x;
    scanf("%d", &x);
    double r1 = (sum[x] - sum[x - T]) * 1.0 / T;
    double r2 = b[x];
    double r3 = abs(r1 - r2) / r1;
    printf("%.15f %.15f %.15f\n", r1, r2, r3);
  }
  return 0;
}
