#include <bits/stdc++.h>
using namespace std;
int n, T, m, q;
double c;
int a[200005];
long long s[200005];
double p[200005];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> T >> c;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s[i + 1] = a[i] + s[i];
    p[i] = (i > 0) ? p[i - 1] : 0;
    p[i] = (p[i] + (double)a[i] / T) / c;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> q;
    double real = (s[q] - s[q - T]) / (double)T;
    double approx = p[q - 1];
    cout << fixed << setprecision(6) << real << ' ' << approx << ' '
         << abs(approx - real) / real << '\n';
  }
  return 0;
}
