#include <bits/stdc++.h>
using namespace std;
int N, T, M;
double c;
int sz;
double A[200100], sum, rea, apr, err;
double R[200100], P[200100], E[200100];
int x;
int main() {
  cout << setprecision(10) << fixed;
  scanf("%d %d %lf", &N, &T, &c);
  for (long long I = 1; I <= N; I++) {
    if (sz == T) sum -= A[I % T], sz--;
    scanf("%lf", &A[I % T]);
    sum += A[I % T];
    sz++;
    apr = (apr + (A[I % T]) / T) / c;
    rea = sum / sz;
    err = fabs(apr - rea) / rea;
    R[I] = rea;
    P[I] = apr;
    E[I] = err;
  }
  scanf("%d", &M);
  for (long long I = 1; I <= M; I++) {
    scanf("%d", &x);
    printf("%.6lf %.6lf %.6lf\n", R[x], P[x], E[x]);
  }
}
