#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int N = (int)2e5;
const int MODULO = (int)1e9 + 7;
double a[N + 10];
void task() {
  int n, T;
  double c;
  scanf("%d %d %lf", &n, &T, &c);
  for (int i = 1; i <= n; ++i) {
    scanf("%lf", &a[i]);
  }
  double mean = .0;
  bool flag = 0;
  int m, s;
  scanf("%d", &m);
  for (int i = 1; i <= n; ++i) {
    mean = (mean + a[i] / T) / c;
    a[i] += a[i - 1];
    if (!flag) {
      scanf("%d", &s);
      flag = 1;
    }
    if (s == i) {
      double rl = (a[i] - a[i - T]) / T;
      double er = abs(mean - rl) / rl;
      flag = 0;
      printf("%.8lf %.8lf %.8lf\n", rl, mean, er);
    }
  }
  return;
}
int main() {
  task();
  return 0;
}
