#include <bits/stdc++.h>
using namespace std;
long long SumA[200010];
double Mean[200010];
int main() {
  int n, T;
  double c;
  cin >> n >> T >> c;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    SumA[i + 1] = SumA[i] + a;
    Mean[i + 1] = (Mean[i] + (double)a / T) / c;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int p;
    cin >> p;
    double real = (double)(SumA[p] - SumA[p - T]) / T;
    double approx = Mean[p];
    double error = abs(real - approx) / real;
    cout << fixed << setprecision(6) << real << ' ' << approx << ' ' << error
         << endl;
  }
  return 0;
}
