#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream &operator>>(istream &in, vector<T> &v) {
  for (size_t i = 0; i < v.size(); ++i) in >> v[i];
  return in;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> const &v) {
  for (size_t i = 0; i < v.size(); ++i) out << v[i] << " ";
  return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> const &p) {
  out << p.first << " " << p.second;
  return out;
}
ostream &operator<<(ostream &out, double *const &n) {
  long long v = (long long)((*n) * 1e7);
  char s[32];
  for (int i = 0; i < 32; ++i) s[i] = '0';
  int c = 0;
  if (v == 0) {
    out.put('0');
  } else if (v > 0) {
    while (v > 0 && c < 32) {
      s[c++] = v % 10 + '0';
      v /= 10;
    }
    c = max(c, 8);
    for (int i = c - 1; i >= 0; --i) {
      if (i == 6) out.put('.');
      out.put(s[i]);
    }
  } else if (v < 0) {
    v = -v;
    while (v > 0 && c < 32) {
      s[c++] = v % 10 + '0';
      v /= 10;
    }
    out.put('-');
    c = max(c, 8);
    for (int i = c - 1; i >= 0; --i) {
      if (i == 6) out.put('.');
      out.put(s[i]);
    }
  }
  return out;
}
void solution();
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solution();
  return EXIT_SUCCESS;
}
void solution() {
  int n, T;
  double c;
  cin >> n >> T >> c;
  vector<double> a(n);
  cin >> a;
  vector<double> r1(n), r2(n), r3(n);
  double s = 0;
  double mean = 0;
  for (int i = 0; i < n; ++i) {
    mean = (mean + a[i] / (double)T) / c;
    r2[i] = mean;
  }
  for (int i = 0; i < T; ++i) s += a[i];
  for (int i = T - 1; i < n; ++i) {
    r1[i] = s / (double)T;
    if (i + 1 < n) {
      s += a[i + 1];
      s -= a[i - T + 1];
    }
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int q;
    cin >> q;
    --q;
    r3[q] = abs(r1[q] - r2[q]) / r1[q];
    cout << &r1[q] << " " << &r2[q] << " " << &r3[q] << endl;
  }
}
