#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
int n, m;
double c, t, x;
long double a[1000100], mn[1000100];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  cin >> t >> c;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    a[i] = a[i - 1] + x;
    mn[i] = (mn[i - 1] + x / t) / c;
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> x;
    double real = (a[(int)x] - a[int(x - t)]) / t;
    double approx = mn[(int)x];
    double error = abs(real - approx) / real;
    printf("%.8lf %.8lf %.8lf\n", real, approx, error);
  }
  return 0;
}
