#include <bits/stdc++.h>
using namespace std;
double c;
int mas[2000005], n, m, T, k, ask[2000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> T >> c;
  for (int i = 1; i <= n; ++i) cin >> mas[i];
  cin >> m;
  for (int i = 0; i < m; ++i) cin >> ask[i];
  double mean = 0.0;
  long long sum = 0;
  for (int i = 1; i < T; ++i) {
    mean = (mean + mas[i] / (double)T) / c;
    sum += mas[i];
  }
  for (int i = T; i <= n; ++i) {
    sum += mas[i] - mas[i - T];
    mean = (mean + mas[i] / (double)T) / c;
    if (ask[k] == i) {
      cout.precision(6);
      cout << fixed << (double)sum / T << " " << mean << " "
           << abs((double)sum / T - mean) / ((double)sum / T) << "\n";
      k++;
    }
  }
  return 0;
}
