#include <bits/stdc++.h>
using namespace std;
const int maxn = 500000;
int n, T, m;
int a[maxn], q[maxn];
double c;
double mean = 0.0;
long long sum = 0;
int main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cin >> n >> T >> c;
  for (int i = 0; i < n; ++i) cin >> a[i];
  cin >> m;
  for (int j = 0; j < m; ++j) {
    cin >> q[j];
    --q[j];
  }
  for (int i = 0, j = 0; i < n && j < m; ++i) {
    sum += a[i];
    if (i >= T) sum -= a[i - T];
    mean = (mean + (double)a[i] / T) / c;
    if (q[j] == i) {
      long double real = (long double)sum / T;
      cout << real << ' ' << mean << ' ' << fabsl(mean - real) / real << endl;
      ++j;
    }
  }
  return 0;
}
