#include <bits/stdc++.h>
const int INF = 1e9;
const long long lINF = 1e18;
const double EPS = 1e-12;
using namespace std;
const int N = 200200;
int n, t, m;
double c;
long long a[N];
double approx[N];
int main() {
  scanf("%d%d%lf", &n, &t, &c);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    approx[i] = (approx[i - 1] + a[i] * 1.0 / t) / c;
  }
  for (int i = 1; i <= n; i++) {
    a[i] += a[i - 1];
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int p;
    scanf("%d", &p);
    double real = (double)(a[p] - a[p - t]) / t;
    printf("%.10lf %.10lf %.10lf\n", real, approx[p],
           abs(real - approx[p]) / real);
  }
  return 0;
}
