#include <bits/stdc++.h>
using namespace std;
int a[int(2e5) + 10];
int r[int(2e5) + 10];
int main() {
  ios::sync_with_stdio(false);
  int n, T;
  cin >> n >> T;
  double c;
  cin >> c;
  for (int i = 0; i < n; i++) cin >> a[i];
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) cin >> r[i];
  long long sum = 0;
  double mean = 0;
  for (int i = 0; i < T; i++) {
    sum += a[i];
    mean = (mean + a[i] * 1. / T) / c;
  }
  int tlast = T;
  for (int I = 0; I < m; I++) {
    for (int i = 0; i < r[I] - tlast; i++) {
      sum = sum - a[tlast - T + i] + a[tlast + i];
      mean = (mean + a[tlast + i] * 1. / T) / c;
    }
    tlast = r[I];
    cout << setprecision(6) << fixed;
    cout << sum * 1. / T << ' ' << mean << ' '
         << abs(mean - sum * 1. / T) / (sum * 1. / T) << endl;
  }
  return 0;
}
