#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int inf = (int)1e9 + 5;
const long long INF = (long long)1e18 + 5;
void solve() {
  long long n, T;
  double c;
  cin >> n >> T >> c;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long m, x;
  vector<bool> print_ans(n, false);
  cin >> m;
  for (long long i = 0; i < m; i++) {
    cin >> x;
    x--;
    print_ans[x] = true;
  }
  double mean = 0, real, approx, error;
  vector<long long> pref(n);
  for (long long i = 0; i < n; i++) {
    pref[i] = a[i];
    if (i - 1 >= 0) pref[i] += pref[i - 1];
    mean = (mean + a[i] * 1.0 / T) / c;
    if (!print_ans[i]) continue;
    long long sum = pref[i];
    if (i - T >= 0) sum -= pref[i - T];
    real = sum * 1.0 / T;
    approx = mean;
    error = abs(approx - real) / real;
    cout << real << " " << approx << " " << error << endl;
  }
}
int main() {
  string filename = "acm";
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(15);
  solve();
  (void)0;
  return 0;
}
