#include <bits/stdc++.h>
struct file_opener {
  FILE *in, *out;
  file_opener(std ::string file_name) {
    in = freopen((file_name + ".in").c_str(), "r", stdin);
    out = freopen((file_name + ".out").c_str(), "w", stdout);
  }
  file_opener(std ::string input_file, std ::string output_file) {
    in = freopen((input_file + ".txt").c_str(), "r", stdin);
    out = freopen((output_file + ".txt").c_str(), "w", stdout);
  }
  ~file_opener() {
    fclose(in);
    fclose(out);
  }
};
using namespace std;
vector<long double> v;
vector<pair<pair<long double, long double>, long double> > ans;
int main() {
  cout.setf(cout.fixed);
  cout.precision(7);
  long double real, approx, error;
  real = approx = error = 0;
  int n, t;
  long double c, f;
  cin >> n >> t >> c;
  for (int i = 0; i < (int)n; i++) {
    cin >> f;
    real += f;
    if (i >= t) real -= v[i - t];
    approx = (approx + f / t) / c;
    v.push_back(f);
    error = fabs(real / t - approx) / (real / t);
    if (i + 1 < t) continue;
    ans.push_back(make_pair(make_pair(real / t, approx), error));
  }
  cin >> n;
  int tf;
  for (int i = 0; i < (int)n; i++) {
    cin >> tf;
    tf -= t;
    cout << ans[tf].first.first << ' ' << ans[tf].first.second << ' '
         << ans[tf].second << '\n';
  }
  return 0;
}
