In this problem you will have to deal with a real algorithm that is used in the VK social network.

As in any other company that creates high-loaded websites, the VK developers have to deal with request statistics regularly. An important indicator reflecting the load of the site is the mean number of requests for a certain period of time of T seconds (for example, T = 60 seconds = 1 min and T = 86400 seconds = 1 day). For example, if this value drops dramatically, that shows that the site has access problem. If this value grows, that may be a reason to analyze the cause for the growth and add more servers to the website if it is really needed.

However, even such a natural problem as counting the mean number of queries for some period of time can be a challenge when you process the amount of data of a huge social network. That's why the developers have to use original techniques to solve problems approximately, but more effectively at the same time.

Let's consider the following formal model. We have a service that works for n seconds. We know the number of queries to this resource a_{t} at each moment of time t (1 ≤ t ≤ n). Let's formulate the following algorithm of calculating the mean with exponential decay. Let c be some real number, strictly larger than one.

// setting this constant value correctly can adjust   

// the time range for which statistics will be calculated

double c = some constant value; 



// as the result of the algorithm's performance this variable will contain 

// the mean number of queries for the last 

// T seconds by the current moment of time

double mean = 0.0; 



for t = 1..n: // at each second, we do the following:

    // a_{t} is the number of queries that came at the last second;

    mean = (mean + a_{t} / T) / c;



Thus, the mean variable is recalculated each second using the number of queries that came at that second. We can make some mathematical calculations and prove that choosing the value of constant c correctly will make the value of mean not very different from the real mean value a_{x} at t - T + 1 ≤ x ≤ t. 

The advantage of such approach is that it only uses the number of requests at the current moment of time and doesn't require storing the history of requests for a large time range. Also, it considers the recent values with the weight larger than the weight of the old ones, which helps to react to dramatic change in values quicker.

However before using the new theoretical approach in industrial programming, there is an obligatory step to make, that is, to test its credibility practically on given test data sets. Your task is to compare the data obtained as a result of the work of an approximate algorithm to the real data. 

You are given n values a_{t}, integer T and real number c. Also, you are given m moments p_{j} (1 ≤ j ≤ m), where we are interested in the mean value of the number of queries for the last T seconds. Implement two algorithms. The first one should calculate the required value by definition, i.e. by the formula $\frac{a_{p_{j} - T + 1} + a_{p_{j}} - T + 2 + \ldots + a_{p_{j}}}{T}$. The second algorithm should calculate the mean value as is described above. Print both values and calculate the relative error of the second algorithm by the formula $\frac{|\text{approx-real}|}{\text{real}}$, where approx is the approximate value, obtained by the second algorithm, and real is the exact value obtained by the first algorithm.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 2·10^5), integer T (1 ≤ T ≤ n) and real number c (1 < c ≤ 100) — the time range when the resource should work, the length of the time range during which we need the mean number of requests and the coefficient c of the work of approximate algorithm. Number c is given with exactly six digits after the decimal point.

The next line contains n integers a_{t} (1 ≤ a_{t} ≤ 10^6) — the number of queries to the service at each moment of time.

The next line contains integer m (1 ≤ m ≤ n) — the number of moments of time when we are interested in the mean number of queries for the last T seconds.

The next line contains m integers p_{j} (T ≤ p_{j} ≤ n), representing another moment of time for which we need statistics. Moments p_{j} are strictly increasing.


-----Output-----

Print m lines. The j-th line must contain three numbers real, approx and error, where:  [Image] is the real mean number of queries for the last T seconds;  approx is calculated by the given algorithm and equals mean at the moment of time t = p_{j} (that is, after implementing the p_{j}-th iteration of the cycle);  $\text{error} = \frac{|\text{approx-real}|}{\text{real}}$ is the relative error of the approximate algorithm. 

The numbers you printed will be compared to the correct numbers with the relative or absolute error 10^{ - 4}. It is recommended to print the numbers with at least five digits after the decimal point.


-----Examples-----
Input
1 1 2.000000
1
1
1

Output
1.000000 0.500000 0.500000

Input
11 4 1.250000
9 11 7 5 15 6 6 6 6 6 6
8
4 5 6 7 8 9 10 11

Output
8.000000 4.449600 0.443800
9.500000 6.559680 0.309507
8.250000 6.447744 0.218455
8.000000 6.358195 0.205226
8.250000 6.286556 0.237993
6.000000 6.229245 0.038207
6.000000 6.183396 0.030566
6.000000 6.146717 0.024453

Input
13 4 1.250000
3 3 3 3 3 20 3 3 3 3 3 3 3
10
4 5 6 7 8 9 10 11 12 13

Output
3.000000 1.771200 0.409600
3.000000 2.016960 0.327680
7.250000 5.613568 0.225715
7.250000 5.090854 0.297813
7.250000 4.672684 0.355492
7.250000 4.338147 0.401635
3.000000 4.070517 0.356839
3.000000 3.856414 0.285471
3.000000 3.685131 0.228377
3.000000 3.548105 0.182702

Source: codeforces | Difficulty: MEDIUM
Tags: Implementation


Solutions:
import math
s = input().split(' ')
(n, tm, k) = (int(s[0]), int(s[1]), float(s[2]))
rq = [int(c) for c in input().split(' ')]
m = int(input())
cr = {int(c) for c in input().split(' ')}
(sr, ma) = (0, 0)
alv = []
for (c, t) in enumerate(rq):
	ma = (ma + t / tm) / k
	sr += t
	l = c - tm
	l = rq[l] if l >= 0 else 0
	sr -= l
	if c + 1 in cr:
		mr = sr / tm
		df = abs((ma - mr) / mr)
		alv.append((mr, ma, df))
for c in alv:
	print(c[0], c[1], c[2])


__author__ = 'ruckus'
(n, T, c) = input().split()
n = int(n)
T = int(T)
c = float(c)
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
res_a = 0
real = 0
maxi_q = max(q)
q_n = 0
for i in range(q[-1]):
	res_a = (res_a + a[i] / T) / c
	real += a[i]
	if i >= T:
		real -= a[i - T]
	if q[q_n] == i + 1:
		q_n += 1
		r = real / T
		print(r, res_a, abs(r - res_a) / r)


import math
mean = [0.0] * 200010
real = [0.0] * 200010
(n, T, c) = input().split()
n = int(n)
T = int(T)
c = float(c)
t = T
a = [0] + [int(x) for x in input().split()]
for i in range(1, n + 1):
	mean[i] = (mean[i - 1] + a[i] / T) / c
	real[i] = real[i - 1] + a[i]
m = int(input())
q = [int(x) for x in input().split()]
for i in range(m):
	r = (real[q[i]] - real[q[i] - t]) / T
	ap = mean[q[i]]
	print('{:.6f} {:.6f} {:.6f}'.format(r, ap, math.fabs(ap - r) / r))


from sys import stdin, stdout
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import *
from random import *
input = stdin.readline
prin = stdout.write
from random import sample
from collections import Counter, deque
from fractions import *
from math import sqrt, ceil, log2, gcd, cos, pi
mod = 10 ** 9 + 7
mod2 = 998244353

def ps(n):
	cp = 0
	lk = 0
	arr = {}
	lk = 0
	ap = n
	cc = 0
	while n % 2 == 0:
		n = n // 2
		cc = 1
	if cc == 1:
		lk += 1
	for ps in range(3, ceil(sqrt(n)) + 1, 2):
		cc = 0
		while n % ps == 0:
			n = n // ps
			cc = 1
		lk += 1 if cc == 1 else 0
	if n != 1:
		lk += 1
	if lk == 1:
		return [False, 0]
	return [True, lk]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def factorials(n, r):
	slr = n
	dpr = r
	qlr = 1
	qs = 1
	mod = 10 ** 9 + 7
	for ip in range(n - r + 1, n + 1):
		qlr = qlr * ip % mod
	for ij in range(1, r + 1):
		qs = qs * ij % mod
	ans = qlr * modInverse(qs) % mod
	return ans

def modInverse(b):
	qr = 10 ** 9 + 7
	return pow(b, qr - 2, qr)
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def power(arr):
	listrep = arr
	subsets = []
	for i in range(2 ** len(listrep)):
		subset = []
		for k in range(len(listrep)):
			if i & 1 << k:
				subset.append(listrep[k])
		subsets.append(subset)
	return subsets

def pda(n):
	list = []
	su = 0
	for i in range(1, int(sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				list.append(i)
				su += i
			else:
				list.append(n // i)
				list.append(i)
				su += i
				su += n // i
	return su

def dis(xa, ya, xb, yb):
	return sqrt((xa - xb) ** 2 + (ya - yb) ** 2)

def ii():
	return int(input())

def ilist():
	return [float(x) for x in input().strip().split()]

def islist():
	return list(map(str, input().split().rstrip()))

def inp():
	return input().strip()

def google(test, ans):
	return 'Case #' + str(test) + ': ' + str(ans)

def overlap(x1, y1, x2, y2):
	if x2 > y1:
		return y1 - x2
	if y1 > y2:
		return y2 - x2
	return y1 - x2

def dist(x1, y1, x2, y2):
	return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

def sieve(n):
	ans = [i + 1 for i in range(n + 1)]
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
				ans[i] += p
				if i // p != p:
					ans[i] += i // p
		p += 1
	ans[0] = 0
	ans[1] = 1
	dicts = {}
	for j in range(n + 1):
		dicts[ans[j]] = j
	return dicts

def prod(arr):
	n = len(arr)
	k = 1
	for j in range(n):
		k *= arr[j]
	return k
t = 1
for p in range(t):
	(n, t, c) = ilist()
	n = int(n)
	t = int(t)
	arr = ilist()
	arr = [int(i) for i in arr]
	m = ii()
	mrr = ilist()
	mrr = [int(i) for i in mrr]
	sums = [0] * (n + 1)
	approx = [0] * n
	mean = 0
	for i in range(n):
		sums[i + 1] = sums[i] + arr[i]
		mean = (mean + arr[i] / t) / c
		approx[i] = mean
	for j in range(m):
		real = 0
		if mrr[j] - t >= 0:
			real = (sums[mrr[j]] - sums[mrr[j] - t]) / t
		else:
			real = sums[mrr[j]]
		app = approx[mrr[j] - 1]
		print(real, app, abs(app - real) / real)


a = list(input().split())
(n, T, c) = (int(a[0]), int(a[1]), float(a[2]))
a = list(map(int, input().split()))
m = int(input())
p = list(map(int, input().split()))
sum_a = sum(a[:T - 1])
mean = 0
for t in range(T - 1):
	mean = (mean + a[t] / T) / c
i = 0
for t in range(T - 1, p[-1]):
	sum_a += a[t]
	mean = (mean + a[t] / T) / c
	if t == p[i] - 1:
		real = sum_a / T
		print('%0.6f %0.6f %0.6f' % (real, mean, abs(real - mean) / real))
		i += 1
		if i == len(p):
			break
	sum_a -= a[t - T + 1]


def main():
	s = input().split()
	(n, T, c) = (int(s[0]), int(s[1]), float(s[2]))
	a = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(sumA, approx, mean) = ([0], [], 0.0)
	for i in range(1, n + 1):
		mean = (mean + a[i - 1] / T) / c
		approx.append(mean)
		sumA.append(a[i - 1] + sumA[i - 1])
	ans = [(sumA[q[i]] - sumA[q[i] - T]) / T for i in range(m)]
	for i in range(m):
		print('%.6f' % ans[i], '%.6f' % approx[q[i] - 1], '%.6f' % (abs(approx[q[i] - 1] - ans[i]) / ans[i]))
main()


(n, t, c) = input().split()
n = int(n)
t = int(t)
c = float(c)
a = list(map(int, input().split()))
m = int(input())
p = list(map(int, input().split()))
sums = [a[0]]
for i in range(1, n):
	sums.append(sums[i - 1] + a[i])
approx = [a[0] / (t * c)]
for i in range(1, n):
	approx.append((approx[i - 1] + a[i] / t) / c)
for i in range(m):
	real = (sums[p[i] - 1] - (0 if p[i] == t else sums[p[i] - t - 1])) / t
	appr = approx[p[i] - 1]
	print(real, appr, abs(real - appr) / real)