AtCoder Beginner Contest 057 - Maximum Average Sets

You are given N items.

The value of the i-th item (1 \leq i \leq N) is v_i.

Your have to select at least A and at most B of these items.

Under this condition, find the maximum possible arithmetic mean of the values of selected items.

Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized.  

-----Constraints-----
 - 1 \leq N \leq 50
 - 1 \leq A,B \leq N
 - 1 \leq v_i \leq 10^{15}
 - Each v_i is an integer.

-----Input-----
The input is given from Standard Input in the following format:
N A B
v_1
v_2
...
v_N

-----Output-----
Print two lines.

The first line should contain the maximum possible arithmetic mean of the values of selected items. The output should be considered correct if the absolute or relative error is at most 10^{-6}.

The second line should contain the number of ways to select items so that the mean of the values of selected items is maximized.

-----Sample Input-----
5 2 2
1 2 3 4 5

-----Sample Output-----
4.500000
1

The mean of the values of selected items will be maximized when selecting the fourth and fifth items. Hence, the first line of the output should contain 4.5.

There is no other way to select items so that the mean of the values will be 4.5, and thus the second line of the output should contain 1.

Source: atcoder | Difficulty: MEDIUM


Solutions:
(n, a, b) = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort()
v.reverse()
print(sum(v[:a]) / a)

def combination(n, r):
	a = 1
	b = 1
	for i in range(1, r + 1):
		a *= n - i + 1
		b *= i
	return a // b
c = v.count(v[a - 1])
d = v[:a].count(v[a - 1])
ans = 0
if v[0] != v[a - 1]:
	print(combination(c, d))
else:
	for i in range(d, min(c, b - a + d) + 1):
		ans += combination(c, i)
	print(ans)


(N, A, B) = map(int, input().split())
V = sorted(list(map(int, input().split())))[::-1]
W = sum(V[:A]) / A
print(W)
f = [1]
for n in range(50):
	f += [f[-1] * (n + 1)]
x = V.count(V[A - 1])
if V[0] == V[A - 1]:
	print(sum((f[x] // (f[x - n] * f[n]) for n in range(A, B + 1))))
else:
	y = V[:A].count(V[A - 1])
	print(f[x] // (f[x - y] * f[y]))


import math

def combinations_count(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
v.reverse()
print(sum(v[:a]) / a)
c = v.count(v[a - 1])
d = v[:a].count(v[a - 1])
if v[0] != v[a - 1]:
	print(combinations_count(c, d))
else:
	ans = 0
	lim = min(c, b)
	for i in range(a, lim + 1):
		ans += combinations_count(c, i)
	print(ans)


import sys
try:
	from typing import List
except ImportError:
	pass

def comb(n: int, r: int):
	if r > n - r:
		return comb(n, n - r)
	p = q = 1
	for i in range(r):
		p *= n - i
		q *= i + 1
	return p // q

def solve(N: int, A: int, B: int, v: 'List[int]'):
	v.sort(reverse=True)
	sl = v[:A]
	print(sum(sl) / A)
	if len(set(sl)) == 1:
		m = sl[0]
		cm = v.count(m)
		ans = 0
		for z in range(A, min(cm, B) + 1):
			ans += comb(cm, z)
		print(ans)
	else:
		m = sl[-1]
		cm = v.count(m)
		print(comb(cm, sl.count(m)))

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	N = int(next(tokens))
	A = int(next(tokens))
	B = int(next(tokens))
	v = [int(next(tokens)) for _ in range(N)]
	solve(N, A, B, v)

def __starting_point():
	main()
__starting_point()


import math
from collections import Counter

def comb(n, r):
	f = math.factorial
	return f(n) // (f(r) * f(n - r))
(N, A, B) = list(map(int, input().split()))
v = sorted(list(map(int, input().split())), reverse=True)
m = sum(v[:A]) / A
c = Counter(v[:A])
a = v[A - 1]
n = v.count(a)
r = c[a]
ans = comb(n, r)
if v[0] == v[A]:
	for i in range(r + 1, min(r + (B - A) + 1, n + 1)):
		ans += comb(n, i)
print(m)
print(ans)


import math

def C(n, r):
	fact = math.factorial
	return fact(n) // fact(r) // fact(n - r)
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v_sort = sorted(v, reverse=True)
print(sum(v_sort[:A]) / A)
(a, b) = (v_sort.count(v_sort[A - 1]), v_sort[:A].count(v_sort[A - 1]))
if v_sort[0] == v_sort[A - 1]:
	print(sum([C(a, r) for r in range(A, min(B, a) + 1)]))
else:
	print(C(a, b))


from math import factorial as ff

def cc(n, r):
	return ff(n) // ff(n - r) // ff(r)
(n, a, b) = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)
ans = 0
x = l[:a]
ave = sum(x) / a
m = l.count(x[0 - 1])
if len(set(x)) == 1:
	for i in range(a, min(b, m) + 1):
		ans += cc(m, i)
else:
	p = x.count(x[-1])
	ans = cc(m, p)
print(ave)
print(ans)


def main():
	(N, A, B) = map(int, input().split())
	v = list(map(int, input().split()))
	v.sort(reverse=True)
	Amxv = sum(v[:A])
	c = v[A - 1]
	m = v[:A].count(c)
	n = v.count(c)
	fl = [1] * (N + 1)
	for i in range(N):
		fl[i + 1] = fl[i] * (i + 1)
	print(Amxv / A)
	if v[0] - c == 0:
		print(sum([fl[n] // (fl[i] * fl[n - i]) for i in range(A, min(B, n) + 1)]))
	else:
		print(fl[n] // (fl[m] * fl[n - m]))
main()


from math import comb
mod = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
print(sum(v[:a]) / a)
if v[0] != v[a - 1]:
	cur = v[a - 1]
	cnt = 0
	for i in range(n):
		if cur == v[i]:
			cnt += 1
	cnt2 = 0
	for i in range(a):
		if cur == v[i]:
			cnt2 += 1
	print(comb(cnt, cnt2))
else:
	cur = v[a - 1]
	cnt = 0
	for i in range(n):
		if cur == v[i]:
			cnt += 1
	ans = 0
	for i in range(a, b + 1):
		ans += comb(cnt, i)
	print(ans)


import math
(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V.sort()
S = V[-A:]
avgmax = sum(S) / A
print(avgmax)
Vs = V.count(min(S))
Ss = S.count(min(S))
if min(S) != max(S):
	C = math.factorial(Vs) // (math.factorial(Vs - Ss) * math.factorial(Ss))
	print(C)
else:
	i = A
	C = 0
	while i <= B and V[-i] == min(S):
		c = math.factorial(Vs) // (math.factorial(Vs - i) * math.factorial(i))
		C = C + c
		i = i + 1
	print(C)


from functools import reduce

def fact(n):
	if n == 0:
		return 1
	return reduce(lambda a, b: a * b, range(1, n + 1))

def C(n, r):
	return fact(n) // fact(n - r) // fact(r)
(N, A, B) = map(int, input().split(' '))
v = sorted(map(int, input().split(' ')), reverse=True)
S = sum(v[:A])
print(S / A)
used = v[:A].count(v[A - 1])
all = v.count(v[A - 1])
if v[0] == v[A - 1]:
	ub = min(B, all)
	print(sum((C(all, i) for i in range(A, ub + 1))))
else:
	print(C(all, used))


def ncr(n, r):
	if n < r:
		return 0
	res = 1
	for i in range(1, n + 1):
		res *= i
	for i in range(1, r + 1):
		res //= i
	for i in range(1, n - r + 1):
		res //= i
	return res
(n, a, b) = list(map(int, input().split()))
v = sorted(list(map(int, input().split())), reverse=True)
print(sum(v[0:a]) / a)
if v[0] == v[a - 1]:
	c = v.count(v[0])
	ans = 0
	for i in range(a, b + 1):
		ans += ncr(c, i)
	print(ans)
else:
	k = v.count(v[a - 1])
	r = v[0:a].count(v[a - 1])
	print(ncr(k, r))


import math
from collections import Counter
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
cnt_v = Counter(v)
ave = []
for i in range(A, B + 1):
	ave.append(sum(v[0:i]) / i)
max_ave = max(ave)
ans = 0
for j in range(B - A + 1):
	temp = 1
	if ave[j] == max_ave:
		l = v[:A + j]
		cnt_l = Counter(l)
		for (key, values) in cnt_l.items():
			temp *= math.factorial(cnt_v[key]) // math.factorial(values) // math.factorial(cnt_v[key] - values)
		ans += temp
print(max_ave)
print(ans)


from collections import Counter
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
su = sum(v[:a])
avg = su / a
tot = 0
inside = 0
c = [[0] * 51 for _ in range(51)]
for i in range(n + 1):
	for j in range(i + 1):
		if j == 0 or j == i:
			c[i][j] = 1
		else:
			c[i][j] = c[i - 1][j] + c[i - 1][j - 1]
for i in range(n):
	if v[i] == v[a - 1]:
		tot += 1
		if i < a:
			inside += 1
cnt = 0
if inside == a:
	for i in range(a, b + 1):
		cnt += c[tot][i]
else:
	cnt += c[tot][inside]
print(avg)
print(cnt)


(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
AAA = sum(v[N - A:]) / A
print(AAA)
p = 0
import math
for i in range(A, B + 1):
	ans = v[N - i:]
	if sum(ans) / i == AAA:
		rest = v[:N - i]
		m = ans.count(ans[0])
		n = rest.count(ans[0])
		C = math.factorial(n + m) // (math.factorial(m) * math.factorial(n))
		p += C
print(p)


from collections import Counter
import math
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
MAX = sum(v[:a]) / a
print(MAX)
c = Counter(v)
average_nums = []
for i in range(a, b + 1):
	t = sum(v[:i]) / i
	if t >= MAX:
		average_nums.append(Counter(v[:i]))

def nCr(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans = 0
for num in average_nums:
	multi = 1
	for (k, v) in num.items():
		multi = multi * nCr(c[k], v)
	ans += multi
print(ans)


import math

def nCr(n, r):
	return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
(N, A, B) = list(map(int, input().split()))
v = sorted(list(map(int, input().split())), reverse=True)
print(sum(v[:A]) / A)
t = v[A - 1]
(m, u) = (0, 0)
for k in range(A):
	if v[k] == t:
		m += 1
for k in range(A, N):
	if v[k] == t:
		u += 1
if m == A:
	ans = 0
	for k in range(A, min(A + u + 1, B + 1)):
		ans += nCr(m + u, k)
	print(ans)
else:
	print(nCr(m + u, m))


import collections
import math
(N, A, B) = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
print(sum(x[-A:]) / A)
c = collections.Counter(x)
s = 0
ans = 0
for i in range(N - 1, 0, -1):
	t = s
	s += c.get(x[i])
	if s >= A and t == 0:
		for j in range(A, min(c.get(x[i]), B) + 1):
			ans += math.factorial(c.get(x[i])) / (math.factorial(c.get(x[i]) - j) * math.factorial(j))
		break
	elif s >= A:
		ans = math.factorial(c.get(x[i])) / (math.factorial(c.get(x[i]) - (A - t)) * math.factorial(A - t))
		break
print(int(ans))


import sys
from collections import Counter
from itertools import product
from random import randint
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

def debug(n, a, b, V, ave):
	cnt = 0
	for pattern in product([0, 1], repeat=n):
		if a <= sum(pattern) <= b:
			tot = 0
			for (idx, p) in enumerate(pattern):
				if p == 1:
					tot += V[idx]
			res = tot / sum(pattern)
			if abs(res - ave) <= 10 ** (-6):
				cnt += 1
	return cnt

def resolve():
	(n, a, b) = list(map(int, input().split()))
	V = list(map(int, input().split()))
	V.sort(reverse=True)
	ave = 0
	for i in range(a, b + 1):
		tot = sum(V[:i])
		if ave <= tot / i:
			ave = tot / i
			used = V[:i]
	if len(set(used)) == 1:
		cnt = V.count(used[0])
		ave = used[0]
		cmb = [0] * len(used)
		for i in range(a, len(used) + 1):
			x = y = 1
			for j in range(1, i + 1):
				x *= cnt + 1 - j
				y *= j
			cmb[i - 1] = x // y
		res = sum(cmb)
	else:
		use_cnt = Counter(used)
		used = set(used)
		D = Counter(V)
		res = 1
		for num in used:
			cnt = use_cnt[num]
			x = y = 1
			for j in range(1, cnt + 1):
				x *= D[num] + 1 - j
				y *= j
			res *= x // y
	print(ave)
	print(res)

def __starting_point():
	resolve()
__starting_point()


(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
AVERAGE = V[:A]
print(sum(AVERAGE) / A)
MIN = AVERAGE[-1]
MINUSE = 0
for a in AVERAGE:
	if a == MIN:
		MINUSE += 1
MAXUSE = 0
for a in V[:B]:
	if a == MIN:
		MAXUSE += 1
ALLUSE = 0
for a in V:
	if a == MIN:
		ALLUSE += 1
import math
if V[0] != MIN:
	print(math.factorial(ALLUSE) // math.factorial(MINUSE) // math.factorial(ALLUSE - MINUSE))
else:
	ANS = 0
	for use in range(MINUSE, MAXUSE + 1):
		ANS += math.factorial(ALLUSE) // math.factorial(use) // math.factorial(ALLUSE - use)
	print(ANS)


(N, A, B) = map(int, input().split())
V = sorted(list(map(int, input().split())), reverse=True)
D = dict()
for i in range(N):
	D[V[i]] = D.get(V[i], 0) + 1
X = [1]
for i in range(1, 51):
	X.append(X[-1] * i)

def cmb(n, r):
	return X[n] // (X[r] * X[n - r])
P = 0
if V[0] == V[A - 1]:
	for i in range(A, B + 1):
		if i > D[V[0]]:
			break
		P += cmb(D[V[0]], i)
else:
	Q = 0
	for i in range(A - 1, -1, -1):
		if V[i] != V[A - 1]:
			break
		Q += 1
	P = cmb(D[V[A - 1]], Q)
print(sum(V[:A]) / A)
print(P)


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def TUPLE():
	return tuple(map(int, input().split()))

def ZIP(n):
	return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 6
mod = 998244353
lim = 50
fact = [1] * (lim + 1)
for n in range(1, lim + 1):
	fact[n] = n * fact[n - 1]

def C(n, r):
	return fact[n] // fact[n - r] // fact[r]
(N, A, B) = MAP()
v = sorted(LIST(), reverse=True)
V_cnt = Counter(v)
V_max = Counter(v[:A])
key = v[A - 1]
print(sum(v[:A]) / A)
v = v[::-1]
idx_1 = bisect_left(v, key)
idx_2 = bisect(v, key)
n = idx_2 - idx_1
k = bisect(v, key)
m = N - k
if m == 0:
	ans = 0
	for i in range(A, min(B - m, n) + 1):
		ans += C(n, i)
	print(ans)
else:
	print(C(n, A - m))


import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
(N, A, B) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for i in range(A, B + 1):
	ans = max(sum(v[:i]) / i, ans)
cnt = 0
for i in range(A, B + 1):
	if sum(v[:i]) / i == ans:
		n = v.count(v[i - 1])
		r = i - v.index(v[i - 1])
		cnt += math.factorial(n) // math.factorial(r) // math.factorial(n - r)
print(ans)
print(cnt)


from collections import Counter
from math import prod
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
factorial = [1 for i in range(N + 1)]
for i in range(1, N + 1):
	if i == 1:
		factorial[i] = 1
	else:
		factorial[i] = factorial[i - 1] * i

def comb(n, k):
	return factorial[n] * pow(factorial[n - k] * factorial[k], -1)
v = sorted(v, reverse=True)
if len(set(v[:A])) == 1:
	print(v[0])
	ans = 0
	for i in range(A, B + 1):
		if i > 1 and v[i - 1] != v[i - 2]:
			break
		ans += comb(Counter(v)[v[0]], i)
	print(int(ans))
	return
print(sum(v[:A]) / A)
c = Counter(v)
thr = v[A - 1]
if c[thr] == 1 or v[A - 1] != v[A]:
	res = []
	for k in c.keys():
		if k >= thr:
			res.append(c[k])
	print(prod(res))
	return
res = []
for k in c.keys():
	if k > thr:
		res.append(c[k])
ans = prod(res)
idx = v[:A].index(v[A - 1]) - 1
print(int(ans * comb(c[v[A - 1]], A - 1 - idx)))


(n, a, b) = [int(x) for x in input().split()]
v = sorted([int(x) for x in input().split()], reverse=True)
from collections import Counter
c = Counter(v)
aveMax = 0
avelist = []
for i in range(a, b + 1):
	avetmp = sum(v[:i]) / i
	if avetmp >= aveMax:
		aveMax = avetmp
		avelist.append(Counter(v[:i]))
from math import factorial

def nCm(n, m):
	return factorial(n) // factorial(m) // factorial(n - m)
ans = 0
for i in avelist:
	multi = 1
	for j in i:
		multi = multi * nCm(c[j], i[j])
	ans += multi
print('{:.6f}'.format(aveMax))
print(ans)


(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))

def combination(n, k):
	a = 1
	for i in range(k):
		a *= n - i
		a //= i + 1
	return a
v.sort(reverse=True)
average = sum(v[:a]) / a
print(average)
amount = [a]
for i in range(a + 1, b + 1):
	average2 = sum(v[:i]) / i
	if average == average2:
		amount.append(i)
	else:
		break
com = 0
for i in amount:
	v1 = v[:i]
	v2 = v[i:]
	min_v = min(v1)
	m1 = v1.count(min_v)
	m2 = v2.count(min_v)
	com += combination(m1 + m2, min(m1, m2))
print(com)


from math import factorial

def nCr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))
(n, a, b) = map(int, input().split())
V = sorted(list(map(int, input().split())), reverse=True)
(L1, L2) = (V[:a], V[a:])
ans1 = sum(L1) / a
minv = min(L1)
x = L1.count(minv)
y = L2.count(minv)
ans2 = 0
if x == a:
	for i in range(x, x + min(y, b - a) + 1):
		ans2 += nCr(x + y, i)
else:
	ans2 = nCr(x + y, x)
print(ans1)
print(ans2)


(N, A, B) = [int(i) for i in input().split()]
v = [int(i) for i in input().split()]
v.sort()
v.reverse()
cum = [v[0]]

def comb(n, k):
	if k > n:
		return 0
	ans = 1
	for i in range(k):
		ans *= n - i
	for j in range(k):
		ans = ans // (j + 1)
	return ans
for i in range(1, N):
	cum += [cum[i - 1] + v[i]]
print('{:.10f}'.format(cum[A - 1] / A))
target = v[A - 1]
n = v.count(target)
fromk = A - 1 - v.index(target) + 1
if v[0] == target:
	ans = 0
	for i in range(A, min(B, n) + 1):
		ans += comb(n, i)
	print(ans)
else:
	ans = comb(n, fromk)
	print(ans)


from itertools import accumulate as ac
t = 3099044504245996706400
(N, A, B) = map(int, input().split())
V = sorted([int(a) * t for a in input().split()])[::-1]
(l, r) = (0, 1 << 200)
while r - l > 1:
	m = (l + r) // 2
	if list(ac([v - m for v in V]))[A - 1] >= 0:
		l = m
	else:
		r = m
fa = [1]
for i in range(1, 60):
	fa.append(fa[-1] * i)
C = lambda a, b: fa[a] // (fa[a - b] * fa[b])
print(l / t)
print(sum([C(V.count(V[i - 1]), V[:i].count(V[i - 1])) for i in range(A, B + 1) if sum(V[:i]) == l * i]))


(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()

def f(x, y):
	c = 1
	d = 1
	for i in range(x):
		c *= i + 1
		d *= y - i
	return d // c
p = v[n - a:]
g = sum(p) / a
print(sum(p) / a)
w = 0
for i in range(a, b + 1):
	p = v[n - i:]
	h = sum(p) / i
	if h < g:
		break
	else:
		q = p[0]
		d = v.count(q)
		e = p.count(q)
		w += f(e, d)
print(w)


from operator import mul
from functools import reduce

def cmb(n, r):
	r = min(n - r, r)
	if r == 0:
		return 1
	over = reduce(mul, range(n, n - r, -1))
	under = reduce(mul, range(1, r + 1))
	return over // under
(n, a, b) = map(int, input().split())
lst = list(map(int, input().split()))
lst.sort()
print(sum(lst[-a:]) / a)
pin = lst[-a]
ans = 0
l = lst[:-a].count(pin)
r = lst[-a:].count(pin)
if pin * a == sum(lst[-a:]):
	cnt = 0
	for i in range(a, min(b, l + r) + 1):
		cnt += cmb(l + r, i)
	print(cnt)
	exit()
print(cmb(l + r, r))


import itertools, bisect
from fractions import Fraction
from math import factorial

def comb(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))
(N, A, B) = list(map(int, input().split()))
V = sorted(list(map(int, input().split())), reverse=True)
Ave = [Fraction(a, i) for (i, a) in enumerate(itertools.accumulate(V), 1)]
max_num = max(Ave[A - 1:B])
max_indices = [i for (i, v) in enumerate(Ave) if A <= i + 1 <= B and v == max_num]
Vm = [-v for v in V]
C = 0
for ind in max_indices:
	l = bisect.bisect_left(Vm, Vm[ind])
	r = bisect.bisect_right(Vm, Vm[ind])
	C += comb(r - l, ind - l + 1)
print(float(max_num))
print(C)


from math import factorial
(n, a, b) = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse=True)
ans = sum(v[:a]) / a
ans2 = 0
count1 = v.count(v[a - 1])
index1 = v.index(v[a - 1])

def ncr(x, y):
	return factorial(x) // factorial(y) // factorial(x - y)
if v[0] == v[a - 1]:
	for i in range(a, min(b, count1) + 1):
		ans2 += ncr(count1, i)
else:
	ans2 = ncr(count1, a - index1)
print(ans)
print(ans2)


import math

def comb(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(n, a, b) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=1)
tmp = sum(v[:a])
ans = (tmp, a)
x = [a - 1]
for i in range(a, b):
	tmp += v[i]
	if ans[0] * (i + 1) <= ans[1] * tmp:
		if ans[0] * (i + 1) == ans[1] * tmp:
			x.append(i)
		else:
			x = [i]
print(ans[0] / ans[1])
ans = 0
for i in x:
	(a, b) = (v.count(v[i]), v[i + 1:].count(v[i]))
	ans += comb(a, b)
print(ans)


fact = [1] * 51
for i in range(2, 51):
	fact[i] = fact[i - 1] * i

def Combination(n, k):
	return fact[n] // fact[k] // fact[n - k]
(N, A, B) = map(int, input().split())
v = sorted(list(map(int, input().split())))[::-1]
MAX = sum(v[:A])
print(MAX / A)
M = max(v[:A])
m = min(v[:A])
if M != m:
	(c1, c2) = (v[:A].count(m), v.count(m))
	print(Combination(c2, c1))
else:
	c = v.count(m)
	L = min(B, c)
	ans = 0
	for i in range(A, L + 1):
		ans += Combination(c, i)
	print(ans)


def nCr(n, r):
	return fac[n] // fac[r] // fac[n - r]
(N, A, B) = map(int, input().split())
v = sorted(map(int, input().split()), reverse=True)
fac = [1]
for i in range(N):
	fac.append(fac[-1] * (i + 1))
print(sum(v[:A]) / A)
Cnt = v.count(v[A - 1])
res = 0
if v[0] == v[A - 1]:
	for i in range(A, B + 1):
		res += nCr(Cnt, i)
else:
	M = v[:A].count(v[A - 1])
	res = nCr(Cnt, M)
print(res)


(N, A, B) = map(int, input().split())
vs = list(map(int, input().split()))
vs.sort(reverse=True)
r = sum(vs[:A]) / A
print(r)
vA = vs[A - 1]
I = vs.index(vA)
C = vs.count(vA)
if I != 0:
	r = 1
	for i in range(1, A - I + 1):
		r = r * (C - i + 1) // i
	print(r)
else:
	rs = []
	for n in range(A, B + 1):
		if n - I < 0 or n - I > C:
			continue
		r = 1
		for i in range(1, n - I + 1):
			r = r * (C - i + 1) // i
		rs.append(r)
	r = sum(rs)
	print(r)


from collections import Counter
from math import factorial
(n, a, b) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=True)
max_value = sum(v[:a]) / a
cnt1 = Counter(v)[v[a - 1]]
cnt2 = Counter(v[:a])[v[a - 1]]
comb = factorial(cnt1) // factorial(cnt2) // factorial(cnt1 - cnt2)
if v[a - 1] == v[0]:
	comb = 0
	for i in range(a, min(cnt1, b) + 1):
		comb += factorial(cnt1) // factorial(i) // factorial(cnt1 - i)
print(max_value)
print(comb)


import math

def C(n, r):
	f = math.factorial
	return int(f(n) // f(r) // f(n - r))
(N, A, B) = map(int, input().split())
v = [int(i) for i in input().split()]
v.sort(reverse=True)
m_ave = sum(v[:A]) / A
(x, y) = (v.count(v[A - 1]), v[:A].count(v[A - 1]))
if v[0] == v[A - 1]:
	comb = sum([C(x, i) for i in range(A, min(B, x) + 1)])
else:
	comb = C(x, y)
print(m_ave)
print(comb)


import math
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
v.reverse()
w = 0
for i in range(0, A):
	w += v[i]
ave = w / A
print(ave)
mini = v[A]
C = v[0:A].count(mini)
D = v[0:A].count(mini) + B - A
if v[0] != v[A]:
	D = A
	for k in range(0, A):
		if v[k] > v[A]:
			D -= 1
p = v.count(mini)
D = min(D, p)
q = 0
for k in range(C, D + 1):
	q += math.factorial(p) / (math.factorial(p - k) * math.factorial(k))
print(int(q))


(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
v.reverse()
print(sum(v[:A]) / A)

def fuct(n):
	ret = 1
	while n > 1:
		ret *= n
		n -= 1
	return ret

def P(n, k):
	return fuct(n) // fuct(n - k)

def C(n, k):
	return P(n, k) // fuct(k)
if v[0] != v[A - 1]:
	num = v.count(v[A - 1])
	pick = 0
	for i in range(A):
		if v[i] == v[A - 1]:
			pick += 1
	print(C(num, pick))
else:
	num = v.count(v[A - 1])
	ans = 0
	for i in range(A, min(num + 1, B + 1)):
		ans += C(num, i)
	print(ans)


(n, a, b) = list(map(int, input().split()))
V = list(map(int, input().split()))
V.sort(reverse=True)
s = 0
m = V[a - 1]
ans = sum(V[:a]) / a
print(ans)
cnt = V.count(m)
left = V.index(m)
ans = 0
memo = {}

def combi(m, k):
	if m * 100 + k in memo:
		return memo[m * 100 + k]
	elif k == 0:
		return 1
	else:
		memo[m * 100 + k] = combi(m, k - 1) * (m - k + 1) // k
		return memo[m * 100 + k]
if left == 0:
	for i in range(a, min(b, cnt) + 1):
		ans += combi(cnt, i)
else:
	ans += combi(cnt, a - left)
print(ans)


def combinations(n, r):
	res = 1
	for i in range(n - r + 1, n + 1):
		res *= i
	for i in range(2, r + 1):
		res //= i
	return res
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
mx = sum(v[:A])
ans1 = mx / A
a = v[A]
cnt = v.count(a)
ans2 = 0
for i in range(A, B + 1):
	if A * sum(v[:i]) < i * mx:
		break
	ans2 += combinations(cnt, v[:i].count(a))
print(ans1)
print(ans2)


import math

def f(n):
	return math.factorial(n)
(n, a, b) = map(int, input().split())
V = [int(i) for i in input().split()]
V.sort()
if n == a:
	print(sum(V) / a)
	print(1)
else:
	ans = sum(V[n - a:]) / a
	count1 = V[n - a:].count(V[n - a])
	count2 = V[:n - a].count(V[n - a])
	print(ans)
	if count1 == a:
		ans2 = 0
		for i in range(min(count2 + 1, b - a + 1)):
			ans2 += f(count1 + count2) / f(count1 + i) / f(count2 - i)
		print(round(ans2))
	else:
		print(round(f(count1 + count2) / f(count1) / f(count2)))


(n, a, b, *v) = map(int, open(0).read().split())
v = [0] + v
dp = [[[0, 1]] + [[0, 0] for j in range(b)] for i in range(n + 1)]
for i in range(1, n + 1):
	for j in range(1, b + 1):
		if dp[i - 1][j - 1][0] + v[i] > dp[i - 1][j][0]:
			dp[i][j] = [dp[i - 1][j - 1][0] + v[i], dp[i - 1][j - 1][1]]
		elif dp[i - 1][j - 1][0] + v[i] == dp[i - 1][j][0]:
			dp[i][j] = [dp[i - 1][j][0], dp[i - 1][j][1] + dp[i - 1][j - 1][1]]
		else:
			dp[i][j] = [dp[i - 1][j][0], dp[i - 1][j][1]]
m = 0
for i in range(a, b + 1):
	m = max(m, dp[-1][i][0] / i)
print(m, sum((dp[-1][i][1] * (dp[-1][i][0] / i == m) for i in range(a, b + 1))), sep='\n')


from collections import Counter as c
from functools import lru_cache, reduce

@lru_cache()
def comb(a, b):
	if not a >= b >= 0:
		return 0
	if b == 1:
		return a
	elif b == 0:
		return 1
	return comb(a - 1, b) + comb(a - 1, b - 1)
(n, a, b) = map(int, input().split())
v = sorted(map(int, input().split()))[::-1]
c1 = c(v)
ans1 = sum(v[:a])
ans2 = 0
for i in range(a, b + 1):
	if ans1 * i != sum(v[:i]) * a:
		break
	c2 = c(v[:i])
	ans2 += reduce(lambda x, y: x * y, map(lambda x: comb(c1[x], c2[x]), c2.keys()))
print(ans1 / a, ans2, sep='\n')


(N, A, B) = list(map(int, input().split()))
V = list(map(int, input().split()))
V.sort(reverse=True)
total = sum(V[:A])
ave = total / A
tmp = V[A - 1]
count = V.count(tmp)

def combination(n, r):
	if n - r > r:
		r = n - r
	tmp = 1
	for i in range(n - r + 1, n + 1):
		tmp *= i
	for i in range(1, r + 1):
		tmp //= i
	return tmp
if V[0] == V[A - 1]:
	ans = 0
	for i in range(A, min(B, count) + 1):
		ans += combination(count, i)
else:
	count2 = V[:A].count(tmp)
	ans = combination(count, count2)
print(ave)
print(ans)


d = {}

def nCr(n, r):
	if n < r:
		return 0
	if n == r or r == 0:
		return 1
	if (n, r) in d:
		return d[n, r]
	d[n, r] = nCr(n - 1, r) + nCr(n - 1, r - 1)
	return d[n, r]
(n, a, b) = map(int, input().split())
v = sorted((int(s) for s in input().split()), reverse=True)
print(sum(v[:a]) / a)
x = v.count(v[a - 1])
print(nCr(x, v[:a].count(v[a - 1])) if v[0] > v[a - 1] else sum((nCr(x, i) for i in range(a, b + 1))))


(N, A, B) = map(int, input().split())
vlist = list(map(int, input().split()))
dp = [[(-1, -1)] * (N + 1) for _ in range(N + 1)]
dp[0][0] = (0, 1)
for i in range(1, N + 1):
	dp[i][0] = (0, 1)
	for j in range(1, i + 1):
		dp[i][j] = dp[i - 1][j]
		if dp[i - 1][j - 1][0] + vlist[i - 1] > dp[i][j][0]:
			dp[i][j] = (dp[i - 1][j - 1][0] + vlist[i - 1], dp[i - 1][j - 1][1])
		elif dp[i - 1][j - 1][0] + vlist[i - 1] == dp[i][j][0]:
			dp[i][j] = (dp[i][j][0], dp[i][j][1] + dp[i - 1][j - 1][1])
max_value_avg = 0
for j in range(A, B + 1):
	value_avg = dp[N][j][0] / j
	max_value_avg = max(max_value_avg, value_avg)
answer = 0
for j in range(A, B + 1):
	value_avg = dp[N][j][0] / j
	if value_avg == max_value_avg:
		answer += dp[N][j][1]
print(max_value_avg)
print(answer)


(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
max_mean = sum(v[-a:]) / a
print(max_mean)
from collections import Counter
cva = Counter(v[-a:])
cv = Counter(v)
import math

def ncr(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if v[-a] == max_mean:
	ans = 0
	for k in range(a, min(b, cv[v[-a]]) + 1):
		ans += ncr(cv[v[-a]], k)
	print(ans)
else:
	k0 = cva[v[-a]]
	k1 = cv[v[-a]]
	ans = ncr(k1, k0)
	print(ans)


from math import factorial
(n, a, b) = (int(i) for i in input().split())
v = [int(i) for i in input().split()]
v = sorted(v)[::-1]
print(1.0 * sum(v[:a]) / a)
(x, v2, num) = (v[a - 1], v[:a][::-1], 0)
for i in v2:
	if i == x:
		num += 1
	else:
		break
y = v.count(x)
if num == a:
	(answer, y2) = (0, factorial(y))
	for i in range(a, min(y, b) + 1):
		answer += y2 // (factorial(y - i) * factorial(i))
	print(answer)
else:
	print(factorial(y) // (factorial(y - num) * factorial(num)))


import math
(N, A, B) = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse=True)
total = 0

def combinations_count(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(A):
	total = total + v[i]
else:
	print(total / A)
count = 0
min = v[A - 1]
number = v.count(min)
if v.index(min) == 0:
	for i in range(A, number + 1):
		if i > B:
			break
		count = combinations_count(number, i) + count
	print(count)
else:
	print(combinations_count(number, A - v.index(min)))


import bisect
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
v = v[::-1]
ans = 0
for i in range(a):
	ans += v[i]
print(ans / a)
v = v[::-1]
k = n - bisect.bisect_left(v, v[n - a])
l = n - bisect.bisect_right(v, v[n - a])
ww = k
k = l
l = ww
jkl = [1]
for i in range(1, l + 1):
	jkl.append(jkl[-1] * i)
ass = 0
if l - k == 0:
	print(1)
elif k != 0:
	ass += jkl[l - k] // jkl[a - k] // jkl[l - a]
	print(ass)
else:
	for i in range(a, min(b, l) + 1):
		ass += jkl[l] // jkl[i] // jkl[l - i]
	print(ass)


from sys import stdin

def main():
	readline = stdin.readline
	(N, A, B) = map(int, readline().split())
	v = list(map(int, readline().split()))
	v.sort(reverse=True)
	average = sum(v[:A]) / A
	res = 0
	x = v[A - 1]
	x_count = v.count(x)
	x_count_copy = x_count
	if x == v[0]:
		up = 1
		down = 1
		for i in range(1, A):
			up *= x_count_copy
			x_count_copy -= 1
			down *= i
		if x_count >= B:
			for i in range(A, B + 1):
				up *= x_count_copy
				x_count_copy -= 1
				down *= i
				res += up // down
		else:
			for i in range(A, x_count + 1):
				up *= x_count_copy
				x_count_copy -= 1
				down *= i
				res += up // down
	else:
		m = A
		for i in range(A):
			if v[i] > x:
				m -= 1
			else:
				break
		up = 1
		down = 1
		for i in range(1, m + 1):
			up *= x_count_copy
			x_count_copy -= 1
			down *= i
		res = up // down
	print(average)
	print(res)

def __starting_point():
	main()
__starting_point()


(N, A, B) = map(int, input().split())
items = sorted(list(map(int, input().split())), reverse=True)
ans_lis = items[:A]
ans1 = sum(ans_lis) / A
print(ans1)
i = A
ans2 = 0
while i <= B:
	if sum(items[:i]) / i != ans1:
		break
	min_ = min(items[:i])
	min_in_ans = items[:i].count(min_)
	min_in_all = items.count(min_)
	nCr = {}

	def cmb(n, r):
		if r == 0 or r == n:
			return 1
		if r == 1:
			return n
		if (n, r) in nCr:
			return nCr[n, r]
		nCr[n, r] = cmb(n - 1, r) + cmb(n - 1, r - 1)
		return nCr[n, r]
	ans2 += cmb(min_in_all, min_in_ans)
	i += 1
print(ans2)


from bisect import bisect_left, bisect_right
from decimal import Decimal
from scipy.special import comb
(n, a, b) = map(int, input().split())
v = list(map(lambda x: -int(x), input().split()))
v.sort()
li = [[None] * 2 for _ in range(n + 1)]
for k in range(a, b + 1):
	li[k][0] = -sum(v[:k])
	li[k][1] = comb(bisect_right(v, v[k - 1]) - bisect_left(v, v[k - 1]), k - bisect_left(v, v[k - 1]), exact=True)
ans = [Decimal(0), 0]
for i in range(n + 1):
	if li[i][0] is None:
		continue
	tmp = Decimal(li[i][0]) / Decimal(i)
	if ans[0] == tmp:
		ans[1] += li[i][1]
	elif ans[0] < tmp:
		ans[0] = tmp
		ans[1] = li[i][1]
print(ans[0])
print(ans[1])


(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
a = v[:A]
b = v[:B]
avg = sum(a) / A
print(avg)
c = [[0] * 51 for _ in range(51)]
c[0][0] = 1
for i in range(50):
	c[i + 1][0] = 1
	c[i + 1][i + 1] = 1
	for j in range(i):
		c[i + 1][j + 1] = c[i][j] + c[i][j + 1]
if a[0] == a[-1]:
	ans = 0
	x = v.count(a[0])
	for i in range(A, B + 1):
		if i <= x:
			ans += c[x][i]
else:
	x = v.count(a[-1])
	y = a.count(a[-1])
	ans = c[x][y]
print(ans)


from collections import Counter

def binomial_coefficient(n, r):
	res = 1
	for i in range(r):
		res *= n - i
		res //= i + 1
	return res
(N, A, B) = list(map(int, input().split()))
V = list(map(int, input().split()))
V.sort(reverse=True)
C = Counter(V)
ave = sum(V[:A]) / A
num = V[A - 1]
Nnums = C[num]
if num == V[0]:
	B = min(B, Nnums)
	cnt = 0
	for i in range(A, B + 1):
		cnt += binomial_coefficient(Nnums, i)
else:
	for (k, v) in list(C.items()):
		if k > num:
			A -= v
	cnt = binomial_coefficient(Nnums, A)
print(ave)
print(cnt)


(n, a, b) = map(int, input().split())
vlist = list(reversed(sorted(map(int, input().split()))))
cc = [[0 for _ in range(51)] for _ in range(51)]
for i in range(51):
	for j in range(i + 1):
		if j == 0 or j == i:
			cc[i][j] = 1
		else:
			cc[i][j] = cc[i - 1][j - 1] + cc[i - 1][j]
avg = sum(vlist[:a]) / a
(avaln, avalp) = (0, 0)
for i in range(n):
	if vlist[i] == vlist[a - 1]:
		avaln += 1
		if i < a:
			avalp += 1
cnt = 0
if avalp == a:
	for ap in range(a, b + 1):
		cnt += cc[avaln][ap]
else:
	cnt += cc[avaln][avalp]
print('%.8f' % avg)
print(cnt)


from math import factorial as fact

def comb(n, r):
	denom = fact(r) * fact(n - r)
	return fact(n) // denom
n = list(map(int, input().split()))
l = list(map(int, input().split()))
l = sorted(l)
summ = 0
for i in range(n[1]):
	summ += l[len(l) - 1 - i]
avg = float(summ) / n[1]
last = l[len(l) - n[1]]
lasts = l.count(last)
more = sum((1 for i in l if i > last))
print(avg)
if more != 0:
	answer = comb(lasts, n[1] - more)
	print(answer)
else:
	b = min(lasts, n[2])
	answer = 0
	for i in range(n[1], b + 1):
		answer += comb(lasts, i)
	print(answer)


(N, A, B) = map(int, input().split())
v = [int(x) for x in input().split()]
v.sort(reverse=True)
a = sum(v[:A]) / A
m = min(v[:A])
k = v.count(m)
l = v.index(m)
ans = 0
import math
for i in range(A, B + 1):
	if i == A:
		ans += math.factorial(k) // math.factorial(i - l) // math.factorial(k - i + l)
	elif k - i + l >= 0 and a == m:
		ans += math.factorial(k) // math.factorial(i - l) // math.factorial(k - i + l)
	else:
		break
print('{:.6f}'.format(a))
print(int(ans))


(N, A, B) = list(map(int, input().split()))
v = list(map(int, input().split()))
v = sorted(v, reverse=True)
max_avg = (sum(v[:A]), A)
t = v[A - 1]
num1 = v[:A].count(t)
num2 = v[A:].count(t)
fact = [0] * (N + 1)
ifact = [0] * (N + 1)
inv = [0] * (N + 1)
p = 170141183460469231731687303715884105727

def combination(n, fact, ifact):
	fact[0] = 1
	fact[1] = 1
	ifact[0] = 1
	ifact[1] = 1
	inv[1] = 1
	for i in range(2, n + 1):
		fact[i] = fact[i - 1] * i % p
		inv[i] = p - inv[p % i] * (p // i) % p
		ifact[i] = ifact[i - 1] * inv[i] % p

def op(n, k):
	if k < 0 or k > n or n < 0:
		return 0
	return fact[n] * ifact[k] * ifact[n - k] % p
combination(N, fact, ifact)
res = int(op(num1 + num2, num1))
if v[0] == v[-1]:
	res = 0
	for i in range(A, B + 1):
		res += int(op(N, i))
elif v[0] == v[B - 1]:
	res = 0
	for i in range(A, B + 1):
		res += int(op(num1 + num2, i))
elif v[0] == v[A - 1]:
	res = 0
	for i in range(A, min(B, A + num2) + 1):
		res += int(op(num1 + num2, i))
print(max_avg[0] / max_avg[1])
print(res)


from collections import Counter

def nCr(n, r):
	t = 1
	for i in range(n - r + 1, n + 1):
		t *= i
	for i in range(2, r + 1):
		t //= i
	return t

def main():
	(N, A, B) = list(map(int, input().split()))
	V = list(map(int, input().split()))
	VV = Counter(V)
	m = 0
	c = 0
	for v in sorted(list(VV.keys()), reverse=True):
		vc = VV[v]
		if c + vc <= A:
			m += v * vc
			c += vc
			continue
		break
	else:
		print(m / c)
		print(1)
		return
	min_c = A - c
	max_c = min(B - c, vc)
	m += v * min_c
	c += min_c
	print(m / c)
	if m != c * v:
		max_c = min_c
	r = 0
	for i in range(min_c, max_c + 1):
		r += nCr(vc, i)
	print(r)
main()


from functools import reduce
from operator import mul

def cmb(n, r):
	r = min(n - r, r)
	if r == 0:
		return 1
	return reduce(mul, range(n, n - r, -1)) // reduce(mul, range(r, 0, -1))
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
if v[0] == v[a - 1]:
	print(v[0])
	c = v.count(v[a - 1])
	ans = 0
	for i in range(a, min(c + 1, b + 1)):
		ans += cmb(c, i)
	print(ans)
else:
	print(sum(v[:a]) / a)
	c = v.count(v[a - 1])
	d = 0
	for (key, value) in enumerate(v):
		if value == v[a - 1]:
			d = key
			break
	print(cmb(c, a - d))


(N, A, B) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=True)
factorial_memo = [1]
for i in range(1, N + 1):
	factorial_memo.append(factorial_memo[-1] * i)

def comb(n, r):
	return factorial_memo[n] // (factorial_memo[n - r] * factorial_memo[r])
print(sum(v[:A]) / A)
for i in reversed(range(A, N)):
	if v[i] == v[0]:
		print(sum([comb(i + 1, x) for x in range(A, B + 1)]))
		break
else:
	print(comb(v.count(v[A]), v[:A].count(v[A])))


(N, A, B) = map(int, input().split())
vs = list(map(int, input().split()))
vs.sort(reverse=True)
print(sum(vs[:A]) / A)
iVA = vs.index(vs[A - 1])
numVA = vs.count(vs[A - 1])
comb = [0] * (numVA + 1)
comb[0] = 1
for k in range(1, numVA + 1):
	comb[k] = comb[k - 1] * (numVA - k + 1) // k
if vs[0] != vs[A - 1]:
	print(comb[A - iVA])
else:
	ans = 0
	for k in range(A - iVA, min(B, numVA) + 1):
		ans += comb[k]
	print(ans)


LI = lambda : list(map(int, input().split()))
(N, A, B) = LI()
V = LI()
MAX = 51
finv = [None] * MAX

def comb_init():
	finv[0] = 1
	for i in range(1, MAX):
		finv[i] = finv[i - 1] * i

def comb(n, k):
	return finv[n] // finv[k] // finv[n - k]

def main():
	comb_init()
	V.sort(reverse=True)
	s = sum(V[:A])
	mx = s // A if s % A == 0 else s / A
	print(mx)
	if A == N or V[A - 1] > V[A]:
		print(1)
		return
	x = V.count(V[A])
	ans = 0
	if mx == V[A]:
		for i in range(A, B + 1):
			ans += comb(x, i)
	else:
		y = V[:A].count(V[A])
		ans = comb(x, y)
	print(ans)

def __starting_point():
	main()
__starting_point()


import math

def pcount(n, r):
	return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
(n, a, b) = map(int, input().split())
L = [int(i) for i in input().split()]
L.sort(reverse=True)
T = L[:a]
print(sum(T) / a)
s = 0
Tmin = min(T)
countTminT = T.count(Tmin)
countTminL = L.count(Tmin)
if a == 1 and countTminL == 1:
	s = 1
elif countTminT == a:
	for i in range(a, b + 1):
		if countTminL + 1 == i:
			break
		s += pcount(countTminL, i)
else:
	s += pcount(countTminL, countTminT)
print(s)


from math import factorial
from functools import reduce

def combinations(x, y):
	a = reduce(lambda x, y: x * y, [x - i for i in range(y)])
	b = factorial(y)
	return a // b
(N, A, B) = map(int, input().split())
v = sorted([int(vi) for vi in input().split()], reverse=True)
ans1 = sum(v[:A]) / A
if v[0] != v[A - 1]:
	X = sum([v[A - 1] == v[i] for i in range(N)])
	Y = sum([v[A - 1] == v[i] for i in range(A)])
	ans2 = combinations(X, Y)
else:
	X = sum([v[0] == v[i] for i in range(N)])
	ans2 = sum([combinations(X, i) for i in range(A, B + 1)])
print(ans1)
print(ans2)


from collections import defaultdict
MOD = 10 ** 17 + 3
MAX = 2 * 10 ** 5
fac = [1, 1] + [0] * MAX
finv = [1, 1] + [0] * MAX
inv = [0, 1] + [0] * MAX
for i in range(2, MAX + 2):
	fac[i] = fac[i - 1] * i % MOD
	inv[i] = -inv[MOD % i] * (MOD // i) % MOD
	finv[i] = finv[i - 1] * inv[i] % MOD

def comb(n, r):
	if n < r:
		return 0
	if n < 0 or r < 0:
		return 0
	return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD
(N, A, B) = list(map(int, input().split()))
V = list(map(int, input().split()))
V.sort(reverse=True)
arr = V[:A]
se = set()
mi = 10 ** 18
dic2 = defaultdict(int)
tot = 0
for a in arr:
	tot += a
	dic2[a] += 1
	se.add(a)
	if a < mi:
		mi = a
dic = defaultdict(int)
for v in V:
	dic[v] += 1
if len(se) == 1:
	ans = 0
	for i in range(A, B + 1):
		ans += comb(dic[mi], i)
else:
	ans = comb(dic[mi], dic2[mi])
print(tot / A)
print(ans)


def comb(n, r):
	if n < r:
		return 0
	(si, bo) = (1, 1)
	for i in range(n):
		si *= i + 1
	for i in range(r):
		bo *= i + 1
	for i in range(n - r):
		bo *= i + 1
	return si // bo
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
print(sum(v[:A]) / A)
n = 0
r = 0
for i in range(A):
	if v[i] == v[A - 1]:
		r += 1
		n += 1
for i in range(A, N):
	if v[i] == v[A - 1]:
		n += 1
ans = 0
if v[0] != v[A - 1]:
	print(comb(n, r))
	exit()
for _ in range(A, B + 1):
	ans += comb(n, r)
	r += 1
print(ans)


(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V = sorted(V, reverse=True)
ma = sum(V[:A]) / A
num = 0
MOD = 10 ** 9 + 7
M = 60
fact = [0] * M
fact[0] = 1
for i in range(1, M):
	fact[i] = fact[i - 1] * i

def comb(n, k):
	return fact[n] // fact[n - k] // fact[k]
num = 0
pos = 0
for i in range(N):
	if V[i] == V[A - 1]:
		num += 1
		if i < A:
			pos += 1
ans = 0
if pos == A:
	for i in range(A, B + 1):
		ans += comb(num, i)
else:
	ans += comb(num, pos)
print(ma)
print(ans)


from operator import mul
from functools import reduce

def cmb(n, r):
	if n < r:
		return 0
	if r == 0 or n - r == 0:
		return 1
	r = min(n - r, r)
	u = reduce(mul, range(n, n - r, -1))
	d = reduce(mul, range(1, r + 1))
	return u // d
(n, a, b, *v) = map(int, open(0).read().split())
v.sort(reverse=True)
print(sum(v[:a]) / a)
c = v[a - 1]
cnt = v.count(c)
d = sum((x > c for x in v))
if d:
	print(cmb(cnt, a - d))
else:
	print(sum((cmb(cnt, i) for i in range(a, min(cnt, b) + 1))))


import math

def check(m, A, V):
	(cnt, x) = (0, 0)
	for v in V[:A]:
		x += v - m
		cnt += 1
	return x >= 0

def comb(n, k):
	if k > n - k:
		return comb(n, n - k)
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def main():
	(N, A, B) = list(map(int, input().split(' ')))
	V = list(map(int, input().split(' ')))
	V.sort(reverse=True)
	eps = 10 ** (-15)
	(ok, ng) = (0, 10 ** 16)
	while (ng - ok) / ng > eps:
		mid = (ok + ng) / 2
		if check(mid, A, V):
			ok = mid
		else:
			ng = mid
	ans_v = ok
	min_target_v = V[A - 1]
	target_v_cnt = sum([1 if v == min_target_v else 0 for v in V])
	selected_target_v_cnt = sum([1 if v == min_target_v else 0 for v in V[:A]])
	ans_pattern = comb(target_v_cnt, selected_target_v_cnt)
	if V[0] == min_target_v:
		for i in range(1, B - A + 1):
			if target_v_cnt < selected_target_v_cnt + i:
				break
			ans_pattern += comb(target_v_cnt, selected_target_v_cnt + i)
	print(ans_v)
	print(ans_pattern)

def __starting_point():
	main()
__starting_point()


from scipy.special import comb
ans = 0
(N, A, B) = map(int, input().split())
L = list(map(int, input().split()))
L = sorted(L, reverse=True)
if len(set(L)) == 1:
	print(L[0])
	for i in range(A, B + 1):
		ans += comb(N, i, exact=True)
	print(ans)
	return
print(sum(L[:A]) / A)
R = list(L[:A])
c = L[A - 1]
if len(set(R)) == 1:
	n = L.count(c)
	for i in range(A, min(n, B) + 1):
		ans += comb(n, i, exact=True)
	print(ans)
	return
a = L.count(c)
b = R.count(c)
print(comb(a, b, exact=True))


nCr = {}

def cmb(n, r):
	if r == 0 or r == n:
		return 1
	if r == 1:
		return n
	if (n, r) in nCr:
		return nCr[n, r]
	nCr[n, r] = cmb(n - 1, r) + cmb(n - 1, r - 1)
	return nCr[n, r]
(N, A, B) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=True)
if len(set(v)) == 1:
	print(1)
	print(1125899906842623)
	exit()
m = sum(v[:A]) / A
print(m)
if len(set(v[:A])) == 1:
	ans = 0
	c = v.count(v[0])
	for i in range(A, B + 1):
		if i <= c:
			ans += cmb(c, i)
	print(ans)
	exit()
mi = min(v[:A])
n = v[:A].count(mi)
m = v.count(mi)
print(cmb(m, n))


f_memo = {0: 1, 1: 1}

def f(x):
	nonlocal f_memo
	if x in f_memo:
		return f_memo[x]
	else:
		res = x * f(x - 1)
		f_memo[x] = res
		return res
comb_memo = {}

def comb(n, r):
	nonlocal comb_memo
	if (n, r) in comb_memo:
		return comb_memo[n, r]
	else:
		a = f(n)
		b = f(n - r)
		c = f(r)
		res = a // b // c
		comb_memo[n, r] = res
		return res
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
mu = sum(v[:A]) / A
R = A - 1
for i in range(A, N):
	if v[i] == mu:
		R = i
	else:
		break
R += 1
ans = 0
if R > A:
	for i in range(A, B + 1):
		if i > R:
			break
		ans += comb(R, i)
else:
	min_v = v[A - 1]
	n = v.count(min_v)
	need = v[:A].count(min_v)
	ans += comb(n, need)
print(mu)
print(ans)


from collections import Counter
C = [[0] * 61 for _ in range(61)]
for i in range(61):
	C[i][0] = 1
	for j in range(1, 61):
		C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
cnt1 = Counter(v)
S = sum(v[:A])
print(S / A)
ans = 0
for i in range(A, B + 1):
	s = sum(v[:i])
	if s * A != S * i:
		break
	cnt2 = Counter(v[:i])
	mark = v[:i][-1]
	ans += C[cnt1[mark]][cnt2[mark]]
print(ans)


from math import factorial as f

def cmb(n, r):
	if n < r:
		return 0
	else:
		return f(n) // f(r) // f(n - r)
(n, a, b) = map(int, input().split())
v = sorted(map(int, input().split()), reverse=True)
m = sum(v[:a]) / a
print(m)
i = j = a - 1
while 1:
	if i == 0:
		break
	elif v[i - 1] != v[a - 1]:
		break
	else:
		i -= 1
while 1:
	if j == n - 1:
		break
	elif v[j + 1] != v[a - 1]:
		break
	else:
		j += 1
ans = 0
if i == 0:
	for r in range(a, b + 1):
		ans += cmb(j + 1, r)
else:
	ans += cmb(j - i + 1, a - i)
print(ans)


from itertools import combinations
(N, A, B) = [int(n) for n in input().split()]
v = [int(n) for n in input().split()]
v.sort(reverse=True)
s = sum(v[:A])
avg = s / A
print(s / A)
fac = [1]
for i in range(1, N + 1):
	fac.append(fac[i - 1] * i)

def C(n, k):
	return fac[n] // (fac[k] * fac[n - k])
if v[0] != v[A - 1]:
	cnt_a_1 = len([t for t in v if t == v[A - 1]])
	cnt_a_1_in = len([t for t in v[:A] if t == v[A - 1]])
	print(C(cnt_a_1, cnt_a_1_in))
if v[0] == v[A - 1]:
	cnt_a_1 = len([t for t in v if t == v[A - 1]])
	res = 0
	for i in range(A, B + 1):
		res += C(cnt_a_1, i)
	print(res)


from copy import deepcopy
from fractions import Fraction

def main():
	(n, a, b) = list(map(int, input().split()))
	v = list(map(int, input().split()))
	dp = [[0, 0] for i in range(n + 1)]
	dp[0] = [0, 1]
	for j in range(n):
		dppre = deepcopy(dp)
		for i in range(n):
			vnew = dppre[i][0] + v[j]
			ways = dppre[i][1]
			if vnew > dp[i + 1][0]:
				dp[i + 1] = [vnew, ways]
			elif vnew == dp[i + 1][0]:
				dp[i + 1][1] += ways
	maxave = 0
	for i in range(a, b + 1):
		maxave = max(maxave, Fraction(dp[i][0], i))
	ways = 0
	for i in range(a, b + 1):
		if Fraction(dp[i][0], i) == maxave:
			ways += dp[i][1]
	print(float(maxave))
	print(ways)

def __starting_point():
	main()
__starting_point()


from collections import Counter
import math

def nCr(n, r):
	if n < r:
		return 0
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(n, a, b) = map(int, input().split())
values = [int(i) for i in input().split()]
values.sort(reverse=True)
MAX = sum(values[:a]) / a
print(MAX)
e = a + 1
use_nums = []
for i in range(a, b + 1):
	v = sum(values[:i]) / i
	if v == MAX:
		use_nums.append(Counter(values[:i]))
cd = Counter(values)
ans = 0
for nums in use_nums:
	t = 1
	for (k, v) in nums.items():
		m = cd.get(k)
		t = t * nCr(m, v)
	ans += t
print(ans)


(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V = sorted(V, reverse=True)

def fac(n):
	if n <= 1:
		return 1
	return n * fac(n - 1)

def c(a, b):
	if b == 0:
		return 1
	return fac(a) // fac(b) // fac(a - b)
print(sum(V[:A]) / A)
if V.count(V[0]) >= A:
	ans = 0
	for i in range(A, min(B + 1, V.count(V[0]) + 1)):
		ans += c(V.count(V[0]), i)
else:
	ans = c(V.count(V[A - 1]), V[:A].count(V[A - 1]))
print(ans)


(N, A, B) = list(map(int, input().split()))
v = list(map(int, input().split()))
v = sorted(v)[::-1]
v_ref = sum(v[:A])
i = A
n_min = A
n_max = B
while i < B:
	v_new = v_ref + v[i]
	if i * v_new < (i + 1) * v_ref:
		n_max = i
		break
	if i * v_new > (i + 1) * v_ref:
		n_min = i + 1
	v_ref = v_new
	i += 1

def comb(n, k):
	r = 1
	for (x, y) in zip(list(range(n, n - k, -1)), list(range(1, k + 1))):
		r = r * x
		assert r % y == 0
		r = r // y
	return r
result = 0
for n in range(n_min, n_max + 1):
	v_min = min(v[:n])
	num_min = sum([v_ == v_min for v_ in v])
	num_fixed = sum([v_ > v_min for v_ in v[:n]])
	num_selected = n - num_fixed
	result += comb(num_min, num_selected)
v_max_avg = sum(v[:n_min]) / n_min
print(f'{v_max_avg:.6f}')
print(result)


(N, A, B) = list(map(int, input().split(' ')))
V = list(map(int, input().split(' ')))
V.sort(reverse=True)
max_avr = sum(V[:A]) / A
a_num = V.count(V[A - 1])
a_pos = V[:A].count(V[A - 1])
import math

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
if V[0] == V[A - 1]:
	cnt = sum((nCr(a_num, i) for i in range(A, min(B, a_num) + 1)))
else:
	cnt = nCr(a_num, a_pos)
print('{0:.10f}'.format(max_avr))
print(int(cnt))


import bisect
(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V.sort()
s = sum(V[-A:])
k = V[-A]
l = bisect.bisect_left(V, k)
r = bisect.bisect_right(V, k)
p = N - A

def f(n):
	y = 1
	for i in range(2, n + 1):
		y *= i
	return y
print(s / A)
if r == N:
	a = 0
	for i in range(A, min(B, N - l) + 1):
		a += f(N - l) // f(i) // f(N - l - i)
	print(a)
else:
	print(f(r - l) // f(r - p) // f(p - l))


from collections import defaultdict

def comb(n, r):
	if n < r:
		return 0
	if n < 0 or r < 0:
		return 0
	res = 1
	for i in range(r):
		res *= n
		n -= 1
	for i in range(1, r + 1):
		res //= i
	return res
(N, A, B) = list(map(int, input().split()))
V = list(map(int, input().split()))
V.sort(reverse=True)
mi = 10 ** 18
dic = defaultdict(int)
dic2 = defaultdict(int)
tot = 0
for (i, a) in enumerate(V):
	if i < A:
		tot += a
		dic2[a] += 1
		if a < mi:
			mi = a
	dic[a] += 1
if len(dic2) == 1:
	ans = 0
	for i in range(A, B + 1):
		ans += comb(dic[mi], i)
else:
	ans = comb(dic[mi], dic2[mi])
print(tot / A)
print(ans)


from math import factorial
(N, A, B) = list(map(int, input().split()))
V = [int(i) for i in input().split()]
V.sort(reverse=True)
a = 0
for i in range(A):
	a += V[i]
a /= A
print(a)
c = 0
if V[0] != V[A - 1]:
	r = 0
	while True:
		r += 1
		if V[A - 1 - r] != V[A - 1]:
			break
	n = 0
	while True:
		if A + n > N - 1:
			break
		if V[A + n] != V[A - 1]:
			break
		n += 1
	n += r
	c = round(factorial(n) / factorial(r) / factorial(n - r))
else:
	n = 0
	while True:
		n += 1
		if n > N - 1:
			break
		if V[n] != V[0]:
			break
	B = min(B, n)
	for i in range(B - A + 1):
		c += round(factorial(n) / factorial(A + i) / factorial(n - A - i))
print(c)


from functools import lru_cache
from collections import Counter

@lru_cache()
def comb(a, b):
	if not a >= b >= 0:
		return 0
	if b == 1:
		return a
	elif b == 0:
		return 1
	return comb(a - 1, b) + comb(a - 1, b - 1)
(n, a, b) = map(int, input().split())
v = sorted(map(int, input().split()))[::-1]
tg = v[:a]
avg = sum(tg) / a
ans = 0
e = Counter(v)
for i in range(a, b + 1):
	tmp = 1
	tg = v[:i]
	d = Counter(tg)
	if sum(tg) / i != avg:
		break
	for i in d.keys():
		tmp *= comb(e[i], d[i])
	ans += tmp
print(avg)
print(ans)


(N, A, B) = map(int, input().split())
V = sorted([int(a) for a in input().split()])[::-1]
fa = [1]
for i in range(1, 60):
	fa.append(fa[-1] * i)
C = lambda a, b: fa[a] // (fa[a - b] * fa[b])
print(sum(V[:A]) / A)
print(sum([C(V.count(V[i - 1]), V[:i].count(V[i - 1])) for i in range(A, B + 1) if sum(V[:i]) * A == sum(V[:A]) * i]))


(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

def combination(a, b):
	(u, d) = (1, 1)
	for i in range(b):
		u *= a - i
		d *= b - i
	return u // d
s_i = sum(v[:A])
c_i = A
ans = 0
a = A
while s_i * a == sum(v[:a]) * c_i and a <= B:
	last_num = None
	c = 0
	for i in range(a):
		n = v[i]
		if n == last_num:
			c += 1
		else:
			c = 0
		last_num = n
	ans += combination(v.count(v[a - 1]), c + 1)
	a += 1
print(sum(v[:A]) / A)
print(ans)


from math import factorial as f

def comb(n, r):
	return f(n) // (f(r) * f(n - r))
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
print(sum(v[:a]) / a)
ans = 0
cnt0 = v.count(v[0])
if cnt0 >= a:
	for i in range(a, min(cnt0, b) + 1):
		ans += comb(cnt0, i)
else:
	c = v[a - 1]
	cnt1 = 0
	cnt2 = 0
	for (i, vi) in enumerate(v):
		if vi != c:
			continue
		if i < a:
			cnt1 += 1
		cnt2 += 1
	ans = comb(cnt2, cnt1)
print(ans)


(N, A, B) = map(int, input().split())
V = sorted([int(x) for x in input().split()], reverse=True)
from statistics import mean
from math import comb
maxmean = mean(V[:A])
if V[0] != V[A - 1]:
	n = V.count(V[A - 1])
	k = V[:A].count(V[A - 1])
	way = comb(n, k)
else:
	n = V.count(V[A - 1])
	way = sum((comb(n, k) for k in range(A, min(n, B) + 1)))
print(maxmean)
print(way)


from collections import defaultdict, Counter

def comb(n: int, k: int) -> int:
	ans = 1
	for i in range(1, k + 1):
		ans *= n - i + 1
		ans //= i
	return ans
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
c = Counter(v)
cand = defaultdict(int)
for m in range(a, b + 1):
	s = sum(v[:m])
	k = len(list(filter(lambda x: x == v[m - 1], v[:m])))
	l = c[v[m - 1]]
	cand[s / m] += comb(l, k)
ans1 = max(cand.keys())
print(ans1)
print(cand[ans1])


import statistics
import math

def combinations_count(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(n, a, b) = list(map(int, input().strip().split()))
v = list(map(int, input().strip().split()))
v.sort(reverse=True)
result = 0
mean_min = statistics.mean(v[0:a])
for i in range(a, b + 1):
	st_mean = statistics.mean(v[0:i])
	if mean_min == st_mean:
		v_n = v.count(v[a])
		v_r = v[0:i].count(v[a])
		result += combinations_count(v_n, v_r)
	else:
		break
print(mean_min)
print(result)


(N, A, B) = map(int, input().split())
D = list(map(int, input().split()))
D = sorted(D)[::-1]
import math
from math import comb
print(sum(D[:A]) / A)
ans = 0
if D[0] != D[A - 1]:
	n = D.count(D[A - 1])
	k = D[:A].count(D[A - 1])
	print(comb(n, k))
else:
	ans = 0
	n = D.count(D[A - 1])
	for i in range(A, min(n, B) + 1):
		ans += comb(n, i)
	print(ans)


import sys
import numpy as np
from math import factorial
sr = lambda : sys.stdin.readline().rstrip()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
(N, A, B) = lr()
V = np.array(lr())
V.sort()
ave = V[-A:].sum() / A
print(ave)
border = V[-A]
left_i = np.searchsorted(V, border, side='left')
right_i = np.searchsorted(V, border, side='right')
seg = right_i - left_i
done = N - right_i
use = A - done

def combinations_count(n, r):
	return factorial(n) // factorial(n - r) // factorial(r)
answer = combinations_count(seg, use)
if border == ave:
	for x in range(use + 1, min(B - done, seg) + 1):
		answer += combinations_count(seg, x)
print(answer)


(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
Vs = V[:A]
print(sum(Vs) / A)
Vs = list(set(Vs))
Vs.sort(reverse=True)
com = [[0] * 51 for i in range(51)]
for i in range(51):
	com[i][0] = 1
	for j in range(1, 51):
		com[i][j] = com[i - 1][j - 1] + com[i - 1][j]
if len(Vs) != 1:
	N = V.count(Vs[-1])
	k = V[:A].count(Vs[-1])
	ans = com[N][k]
else:
	ans = 0
	N = V.count(Vs[0])
	for k in range(A, B + 1):
		ans += com[N][k]
print(ans)


def nCr(n, r):
	r = min(r, n - r)
	(x, y) = (1, 1)
	for i in range(n, n - r, -1):
		x *= i
	for i in range(2, r + 1):
		y *= i
	return x // y
(n, a, b) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=True)
print(sum(v[:a]) / a)
if v[0] != v[a - 1]:
	print(nCr(v.count(v[a - 1]), v[:a].count(v[a - 1])))
else:
	c = v.count(v[0])
	m = min(b, c)
	ans = 0
	for i in range(a, m + 1):
		ans += nCr(c, i)
	print(ans)


import math
import functools
(N, A, B) = map(int, input().split())
V = sorted([int(x) for x in input().split()], reverse=True)
print(sum(V[:A]) / A)
threshold = V[:A][-1]
fixed = 0
chosen = 0
for v in V:
	if v > threshold:
		fixed += 1
	elif v == threshold:
		chosen += 1

def nCn(a, b):
	return math.factorial(a) // math.factorial(b) // math.factorial(a - b)
if fixed:
	print(nCn(chosen, A - fixed))
else:
	count = 0
	for i in range(A, min(B, chosen) + 1):
		count += nCn(chosen, i)
	print(count)


(n, a, b) = map(int, input().split())
from decimal import Decimal as de
l = sorted(list(map(int, input().split())), reverse=1)
fact = [1]
for i in range(1, 51):
	fact.append(fact[-1] * i)
from collections import Counter as co
if l[0] == l[a - 1]:

	def comb(x, y):
		return fact[x] // (fact[y] * fact[x - y]) if x >= y >= 0 else 0
	x = co(l)[l[0]]
	print(l[0])
	print(sum((comb(x, i) for i in range(a, b + 1))))
	return
ave = de(str(sum(l[:a]))) / a
print(ave)
y = co(l[:a])[l[a - 1]]
x = co(l)[l[a - 1]]
print(fact[x] // (fact[y] * fact[x - y]))


import itertools, collections
import math

def combinations_count(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
	(n, a, b) = list(map(int, input().split()))
	v = [int(i) for i in input().split()]
	v.sort(reverse=True)
	tmp = v[0:a]
	dd = collections.defaultdict(int)
	for i in v:
		dd[i] += 1
	cnt = 0
	k = 0
	for i in tmp:
		k += i
	s = min(tmp)
	avg = k / len(tmp)
	if tmp[0] != s:
		howmany = v.count(s)
		nantoori = tmp.count(s)
		res = howmany
		for i in range(nantoori - 1):
			res *= howmany - i + 1
		res2 = 1
		for i in range(nantoori):
			res2 *= i + 1
		print(avg)
		print(combinations_count(howmany, nantoori))
	else:
		howmany = dd[s]
		res = 0
		for i in range(a, min(b + 1, howmany + 1)):
			res += combinations_count(howmany, i)
		print(avg)
		print(res)

def __starting_point():
	main()
__starting_point()


from math import factorial

def comb(n, r):
	if n < r:
		return 0
	return factorial(n) // (factorial(r) * factorial(n - r))
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
cnt = 0
cnt2 = 0
for i in range(N):
	if v[i] > v[A]:
		cnt += 1
	if v[i] == v[A]:
		cnt2 += 1
avg_max = sum(v[:A]) / A
print(avg_max)
ans = 0
if v[0] != v[A]:
	print(comb(cnt2, A - cnt))
else:
	for i in range(A, min(B + 1, cnt2 + 1)):
		ans += comb(cnt2, i)
	print(ans)


import math
(N, A, B) = map(int, input().split())
v = sorted(list(map(int, input().split())))[::-1]

def nCr(n, r):
	return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
a = sum(v[:A]) / A
print(a)
s = 0
for k in range(N):
	if v[A - 1] == v[k]:
		s += 1
t = 0
for k in range(A):
	if v[A - 1] == v[k]:
		t += 1
u = 0
for k in range(A - 1, B):
	if v[A - 1] == v[k]:
		u += 1
if a != v[A - 1]:
	print(nCr(s, t))
else:
	c = 0
	for k in range(A, A + u):
		c += nCr(s, k)
	print(c)


from collections import Counter
from math import factorial
(N, A, B) = list(map(int, input().split()))
V = list(map(int, input().split()))
C = Counter(V)
keys = list(C.keys())
keys.sort(reverse=True)
if C[keys[0]] >= A:
	mean = keys[0]
	var = 0
	for i in range(A, min(B, C[keys[0]]) + 1):
		var += factorial(C[keys[0]]) // factorial(i) // factorial(C[keys[0]] - i)
else:
	cnt = 0
	total = 0
	var = 0
	for v in keys:
		if cnt + C[v] < A:
			cnt += C[v]
			total += v * C[v]
		else:
			total += v * (A - cnt)
			mean = total / A
			var += factorial(C[v]) // factorial(A - cnt) // factorial(C[v] - (A - cnt))
			break
print(mean)
print(var)


(N, A, B, *V) = map(int, open(0).read().split())
V = sorted(V)[::-1]
ans1 = sum(V[:A]) / A
print(ans1)
f = [1] * 51
for i in range(1, 51):
	f[i] = f[i - 1] * i

def comb(n, r):
	return f[n] // f[r] // f[n - r]
ans2 = comb(V.count(V[A - 1]), V[:A].count(V[A - 1]))
if V[0] == V[A - 1]:
	for i in range(A + 1, B + 1):
		ans2 += comb(V.count(V[A - 1]), i)
print(ans2)


from collections import Counter
from math import factorial

def comb(n, k):
	return factorial(n) // (factorial(k) * factorial(n - k))
(n, a, b) = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse=True)
cnt = Counter(v)
print(sum(v[:a]) / a)
if v[0] == v[a - 1]:
	x = cnt[v[0]]
	ans = 0
	for i in range(a, min(x, b) + 1):
		ans += comb(x, i)
	print(ans)
else:
	x = cnt[v[a - 1]]
	for i in range(a):
		if v[i] == v[a - 1]:
			y = i
			break
	print(comb(x, a - y))


from collections import Counter
from math import factorial
(N, A, B) = map(int, input().split())
V = sorted(list(map(int, input().split())), reverse=True)
MAX_AVE = sum(V[:A]) / A
C = Counter(V)

def nCr(n, r):
	return int(factorial(n) / (factorial(r) * factorial(n - r)))
Ath_V = V[A - 1]
if Ath_V == max(V):
	ans = 0
	for r in range(A, min(B + 1, C[Ath_V] + 1)):
		ans += nCr(C[Ath_V], r)
	print(MAX_AVE)
	print(ans)
else:
	print(MAX_AVE)
	for (i, v) in enumerate(V):
		if v == Ath_V:
			used = i
			break
	print(nCr(C[Ath_V], A - used))


def fuct(n: int) -> int:
	if n <= 1:
		return 1
	else:
		return n * fuct(n - 1)

def main():
	(n, a, b) = map(int, input().split())
	v = list(map(int, input().split()))
	v = sorted(v, reverse=True)
	print(sum(v[:a]) / a)
	res = 0
	if v[0] == v[a - 1]:
		vn = v.count(v[0])
		for r in range(a, b + 1):
			res += fuct(vn) // (fuct(vn - r) * fuct(r))
	else:
		vn = v.count(v[a - 1])
		r = v[:a].count(v[a - 1])
		res += fuct(vn) // (fuct(vn - r) * fuct(r))
	print(res)
main()


import sys
import math

def comb(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(n, a, b) = map(int, input().split())
v_list = list(map(int, input().split()))
v_list.sort(reverse=True)
max_mean = sum(v_list[:a]) / a
number = v_list[a - 1]
if v_list[:a].count(number) == a:
	count = 0
	for i in range(a, b + 1):
		rest_list = v_list[i:]
		all_num = v_list.count(number)
		rest_num = rest_list.count(number)
		if rest_num > 0 or v_list[i - 1] == number:
			count += comb(all_num, rest_num)
	print(max_mean)
	print(count)
else:
	rest_list = v_list[a:]
	all_num = v_list.count(number)
	rest_num = rest_list.count(number)
	print(max_mean)
	print(comb(all_num, rest_num))


(N, A, B) = list(map(int, input().strip().split()))
v = sorted(list(map(int, input().strip().split())))[::-1]

def frac(n):
	ret = 1
	for i in range(2, n + 1):
		ret *= i
	return ret

def combi(n, a):
	return frac(n) // frac(a) // frac(n - a)
sm = sum(v[:A])
ave = sm / A
ans = 0
minA = v[A - 1]
ct_mA = v[:A].count(minA)
nmA = v.count(minA)
if ave == minA:
	i = 0
	while A + i <= B and i <= nmA - ct_mA:
		ans += combi(nmA, i + A)
		i += 1
else:
	ans = combi(nmA, ct_mA)
print(ave)
print(ans)


from collections import Counter
(N, A, B) = list(map(int, input().split()))
V = list(map(int, input().split()))
V.sort(reverse=True)
S = sum(V[:A])
cnt = A
mx = S / cnt
L = [cnt]
for v in V[A:]:
	if cnt == B:
		break
	cnt += 1
	S += v
	if mx < S / cnt:
		mx = S / cnt
		L = []
	if mx == S / cnt:
		L.append(cnt)

def ncr(n, r):
	ret = 1
	for i in range(r):
		ret *= n - i
	for i in range(1, r + 1):
		ret //= i
	return ret
print(mx)
ans = 0
cntV = Counter(V)
for c in L:
	cnt = Counter(V[:c])
	prd = 1
	for (x, c) in list(cnt.items()):
		prd *= ncr(cntV[x], c)
	ans += prd
print(ans)


from math import factorial

def comb(n, r):
	return factorial(n) // factorial(r) // factorial(n - r)
(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V.sort()
x = V[-1]
ans = 0
for i in range(1, A + 1):
	ans += V[-i]
	x = V[-i]
ans = ans / A
print(ans)
count = 0
import bisect
y = N - bisect.bisect(V, x)
if x == V[-1]:
	n = V.count(x)
	for i in range(A, min(B, V.count(x)) + 1):
		z = i - y
		count += comb(n, z)
else:
	z = A - y
	n = V.count(x)
	count += comb(n, z)
print(count)


from math import factorial
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
u = sorted(v, reverse=True)
m = sum((x == u[A - 1] for x in v))

def c(n, k):
	return factorial(n) // (factorial(n - k) * factorial(k))
ans = '{}\n{}'.format(sum(u[:A]) / A, c(m, A - sum((x > u[A - 1] for x in v))) if u[A - 1] < u[0] else sum((c(m, k) for k in range(A, min(m + 1, B + 1)))))
print(ans)


import math

def f(a, b):
	return math.factorial(a) // (math.factorial(a - b) * math.factorial(b))
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
c = 0
if v[0] == v[a - 1]:
	for i in range(a, min(b, v.count(v[0])) + 1):
		c += f(v.count(v[a - 1]), i)
	print(sum(v[:a]) / a)
	print(c)
else:
	print(sum(v[:a]) / a)
	print(f(v.count(v[a - 1]), v[:a].count(v[a - 1])))


C = [[0 for j in range(51)] for i in range(51)]
for i in range(51):
	C[i][0] = 1
for i in range(1, 51):
	for j in range(1, 51):
		C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
(n, a, b) = list(map(int, input().split()))
(*V,) = list(map(int, input().split()))
V.sort(reverse=True)
print(sum(V[:a]) / a)
if V[0] == V[a - 1]:
	x = V.count(V[a - 1])
	print(sum([C[x][y] for y in range(a, b + 1)]))
else:
	x = V.count(V[a - 1])
	y = a - len([v for v in V if v > V[a - 1]])
	print(C[x][y])


import sys
inp = lambda : sys.stdin.readline()
mi = lambda : map(int, inp().split())
li = lambda : list(map(int, inp().split()))
mf = lambda : map(float, inp().split())
lf = lambda : list(map(float, inp().split()))

def nCk(n, k):
	(u, s) = (1, 1)
	for i in range(n - k + 1, n + 1):
		u *= i
	for i in range(1, k + 1):
		s *= i
	return u // s
(N, A, B) = mi()
vec = lf()
vec.sort()
vec = vec[::-1]
avr = 0.0
for i in range(A):
	avr += vec[i]
avr /= A
print('{:.08f}'.format(avr))
kosu = vec.count(vec[A - 1])
if kosu == 1:
	print(1)
	return
if vec[0] == vec[A - 1]:
	ans = 0
	for i in range(A, B + 1):
		if vec[i - 1] != vec[0]:
			break
		ans += nCk(kosu, i)
	print(ans)
else:
	K = vec[:A].count(vec[A - 1])
	print(nCk(kosu, K))


(n, a, b) = map(int, input().split())
lists = list(map(int, input().split()))
lists = sorted(lists)
P = sum(lists[-a:])
print(P / a)
from collections import Counter
J = dict(Counter(lists))
K = dict(Counter(lists[-a:]))
import math
ans = 1
sums = 0
if J[max(lists)] < a:
	for some in K.keys():
		ans *= math.factorial(J[some]) // (math.factorial(K[some]) * math.factorial(J[some] - K[some]))
	print(ans)
elif J[max(lists)] > a:
	for i in range(a, min(b, J[max(lists)]) + 1):
		sums += math.factorial(J[max(lists)]) // (math.factorial(J[max(lists)] - i) * math.factorial(i))
	print(sums)
else:
	print(1)


class cmbs(object):

	def __init__(self, mod=9007199254740997):
		self.mod = mod
		self.g1 = [1, 1]
		self.g2 = [1, 1]
		inverse = [0, 1]
		for i in range(2, 10 ** 2 + 1):
			self.g1.append(self.g1[-1] * i % mod)
			inverse.append(-inverse[mod % i] * (mod // i) % mod)
			self.g2.append(self.g2[-1] * inverse[-1] % mod)

	def cmb(self, n, r):
		if n > 10 ** 6:
			return self.cmbl(n, r)
		return self.cmbr(n, r)

	def cmbr(self, n, r):
		if r < 0 or r > n:
			return 0
		r = min(r, n - r)
		return self.g1[n] * self.g2[r] * self.g2[n - r] % self.mod

def main():
	(N, A, B) = list(map(int, input().split()))
	v = list(map(int, input().split()))
	v.sort(reverse=True)
	m = sum(v[:A]) / A
	print(m)
	if v.count(v[A - 1]) == N:
		c = cmbs()
		a = 0
		for i in range(A, B + 1):
			a += c.cmb(N, i)
		print(a)
	elif v[0] == v[A - 1]:
		c = cmbs()
		a = 0
		for i in range(A, min(v.count(v[A - 1]), B) + 1):
			a += c.cmb(v.count(v[A - 1]), i)
		print(a)
	elif v.count(v[A - 1]) == 1:
		print(1)
	else:
		c = cmbs()
		r = A - v.index(v[A - 1])
		print(c.cmb(v.count(v[A - 1]), r))
main()


from collections import Counter

def comb(n, r):
	if n < r:
		return 0
	comb = 1
	r = min(r, n - r)
	for i in range(r):
		comb = comb * (n - i) // (i + 1)
	return comb
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
va_count = Counter(v[:a])
v_count = Counter(v)
print(sum(v[:a]) / a)
if v[0] == v[a - 1]:
	print(sum((comb(v_count[v[0]], i) for i in range(a, b + 1))))
else:
	print(comb(v_count[v[a - 1]], va_count[v[a - 1]]))


INF = 10 ** 7
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
from heapq import heappop, heapify, heappush
fac = [1, 1]
for i in range(2, 51):
	fac.append(fac[-1] * i)

def nck(n, k):
	return fac[n] // fac[n - k] // fac[k]

def main():
	(n, a, b) = list(map(int, input().split()))
	v = list(map(int, input().split()))
	v.sort(reverse=True)
	tot = sum(v[:a])
	cnt = a
	ok = 0
	change = 0
	for i in range(a, n):
		if v[i] * cnt == tot:
			ok += 1
		elif v[i] == v[a - 1]:
			change += 1
	same = 1
	for i in range(a - 2, -1, -1):
		if v[i] == v[a - 1]:
			same += 1
	ans = 0
	if ok > 0:
		for i in range(same, b - a + same + 1):
			ans += nck(same + ok, i)
	elif change > 0:
		ans += nck(same + change, same)
	else:
		ans += 1
	print(tot / cnt)
	print(ans)

def __starting_point():
	main()
__starting_point()


import math

def combinations_count(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(N, A, B) = (int(x) for x in input().split())
v = list(map(int, input().strip().split()))
v.sort(reverse=True)
print(sum(v[0:A]) / A)
ctall = 0
ct = 0
for i in range(A):
	if v[i] == v[A - 1]:
		ct += 1
answer = 0
for i in range(N):
	if v[i] == v[A - 1]:
		ctall += 1
	if v[i] < v[A - 1]:
		break
if ct == A:
	for i in range(A, min(ctall + 1, B + 1)):
		answer += combinations_count(ctall, i)
	print(answer)
else:
	print(combinations_count(ctall, ct))


(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
maximum = sum(v[:a])
print(maximum / a)

def comb(n, r):
	if n - r < r:
		r = n - r
	if r < 0:
		return 0
	ans = 1
	for i in range(r):
		ans *= n - i
	for i in range(1, r + 1):
		ans //= i
	return ans
if v[0] == v[a - 1]:
	num = v.count(v[0])
	ans = 0
	for i in range(a, b + 1):
		ans += comb(num, i)
	print(ans)
else:
	num = v.count(v[a - 1])
	r = v[:a].count(v[a - 1])
	print(comb(num, r))


import math

def com(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(n, a, b) = map(int, input().split())
vl = list(map(int, input().split()))
vl.sort(reverse=True)
if vl[0] == vl[a - 1]:
	v = vl[0]
	print(v)
	v_cnt = vl.count(v)
	max_r = min(v_cnt, b)
	ans = 0
	for r in range(a, max_r + 1):
		ans += com(v_cnt, r)
	print(ans)
else:
	print(sum(vl[:a]) / a)
	last_val = vl[a - 1]
	last_val_cnt = vl[0:a].count(last_val)
	all_last_val_cnt = vl.count(last_val)
	print(com(all_last_val_cnt, last_val_cnt))


def comb(left, right):
	top = 1
	for i in range(left, left - right, -1):
		top *= i
	bottom = 1
	for i in range(1, right + 1):
		bottom *= i
	return top // bottom
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
min_set = v[-a:]
print(sum(min_set) / len(min_set))
if len(set(min_set)) == 1:
	cnt = v.count(min_set[0])
	result = 0
	for i in range(a, min(cnt, b) + 1):
		result += comb(cnt, i)
	print(result)
else:
	print(comb(v.count(min_set[0]), min_set.count(min_set[0])))


import math

def com(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(N, A, B) = map(int, input().strip().split(' '))
v = list(map(int, input().strip().split(' ')))
v.sort(reverse=True)
anum = 0
onum = 0
for i in range(N):
	if v[i] == v[A - 1]:
		anum += 1
	elif v[i] > v[A - 1]:
		onum += 1
	if v[i] < v[A - 1]:
		break
ans = 0
if v[0] == v[A - 1]:
	for i in range(A, min(B, anum) + 1):
		ans += com(anum, i)
else:
	ans += com(anum, A - onum)
print(sum(v[:A]) / A)
print(ans)


def inpl():
	return list(map(int, input().split()))
from collections import Counter
from math import factorial
(N, A, B) = inpl()
V = sorted(inpl(), reverse=True)
C = Counter(V)
S = [sum(V[:i]) / i for i in range(1, N + 1)]
M = max(S[A - 1:B])
print(M)
T = [M == s if (A - 1 <= i) * (i < B) else False for (i, s) in enumerate(S)]
res = 0
for i in range(N):
	if T[i]:
		(x, y) = (V.count(V[i]), V[:i + 1].count(V[i]))
		res += factorial(x) // factorial(y) // factorial(x - y)
print(res)


import math
(n, a, b) = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse=True)
ans = 0
many = 0
for i in range(a, b + 1):
	vsumany = sum(v[:i])
	ansi = vsumany / i
	if ans <= ansi:
		ans = ansi
		ci = v.count(v[i - 1])
		cin = v[:i].count(v[i - 1])
		m = math.factorial(ci) // math.factorial(cin) // math.factorial(ci - cin)
		many += m
print(ans)
print(many)


import sys
input = sys.stdin.readline

def main():
	(n, a, b) = list(map(int, input().split()))
	v = list(map(int, input().split()))
	dp = [[0, 0] for _ in range(n + 1)]
	dp[0][1] = 1
	for i in range(n):
		for j in range(n - 1, -1, -1):
			if dp[j][1]:
				if dp[j + 1][0] < dp[j][0] + v[i]:
					dp[j + 1][0] = dp[j][0] + v[i]
					dp[j + 1][1] = dp[j][1]
				elif dp[j + 1][0] == dp[j][0] + v[i]:
					dp[j + 1][1] += dp[j][1]
	(index, value, count) = (a, dp[a][0], dp[a][1])
	for i in range(a + 1, b + 1):
		if value * i == index * dp[i][0]:
			count += dp[i][1]
		elif value * i < index * dp[i][0]:
			value = dp[i][0]
			index = i
			count = dp[i][1]
	print(value / index)
	print(count)

def __starting_point():
	main()
__starting_point()


def main():
	from decimal import Decimal
	(N, A, B) = list(map(int, input().split()))
	(*v,) = list(map(Decimal, input().split()))
	v.sort(reverse=True)
	max_average = sum(v[:A]) / A
	tail = v[A - 1]
	contained = [0] * (N + 1)
	s = 0
	for (i, x) in enumerate(v, start=1):
		if x == tail:
			s += 1
		contained[i] = s

	def choose(n, a):
		if n - a < a:
			return choose(n, n - a)
		(x, y) = (1, 1)
		for i in range(a):
			x = x * (n - i)
			y = y * (i + 1)
		return x // y
	count = 0
	for k in range(A, B + 1):
		if k > A and v[k - 1] != max_average:
			break
		count += choose(contained[-1], contained[k])
	print(max_average)
	print(count)

def __starting_point():
	main()
__starting_point()


from math import factorial
(N, A, B) = map(int, input().split())
V = sorted(list(map(int, input().split())), reverse=True)
C = {}
for i in range(N):
	if V[i] not in C:
		C[V[i]] = 0
	C[V[i]] += 1
v = V[A - 1]
avg = sum(V[:A]) / A
print(avg)
cnt = V[:A].count(v)
if cnt < A:
	tot = factorial(C[v]) // factorial(cnt) // factorial(C[v] - cnt)
else:
	tot = 0
	for j in range(A, min(B, C[v]) + 1):
		tot += factorial(C[v]) // factorial(j) // factorial(C[v] - j)
print(tot)


def comb(n, k):
	x = y = 1
	for i in range(k):
		x *= n - i
		y *= i + 1
	return x // y
(N, A, B) = list(map(int, input().split()))
V = sorted(list(map(int, input().split())), reverse=True)
if V[0] == V[A - 1]:
	n = 0
	for v in V:
		if v != V[0]:
			break
		n += 1
	ans = 0
	for k in range(A, min(B, n) + 1):
		ans += comb(n, k)
else:
	n = k = 0
	for (i, v) in enumerate(V):
		if v == V[A - 1]:
			if i < A:
				k += 1
			n += 1
	ans = comb(n, k)
print(sum(V[:A]) / A)
print(ans)


from collections import Counter
(N, A, B) = map(int, input().split())
src = list(map(int, input().split()))
src.sort(reverse=True)
ave = sum(src[:A]) / A
print(ave)
counter = Counter(src)
cnt = counter[src[0]]
ncr = [[1]]
for n in range(1, N + 1):
	ncr.append([1])
	for r in range(1, n):
		ncr[n].append(ncr[n - 1][r - 1] + ncr[n - 1][r])
	ncr[n].append(1)
if cnt < A:
	last = src[A - 1]
	n = counter[last]
	r = src[:A].count(last)
	print(ncr[n][r])
elif cnt == A:
	print(1)
else:
	ans = 0
	for r in range(A, min(B, cnt) + 1):
		ans += ncr[cnt][r]
	print(ans)


from math import factorial

def comb(a, b):
	if b < 0 or a < b:
		return 0
	return factorial(a) // factorial(b) // factorial(a - b)
(N, A, B) = map(int, input().split())
V = [int(s) for s in input().split()]
V.sort(reverse=True)
ans1 = sum(V[:A]) / A
num = V.count(V[A - 1])
if V[0] == V[A - 1]:
	ans2 = sum([comb(num, m) for m in range(A, B + 1)])
else:
	m = V[:A].count(V[A - 1])
	ans2 = comb(num, m)
print(ans1)
print(ans2)


(N, A, B) = map(int, input().split())
(*v,) = sorted(map(int, input().split()))[::-1]
f = [1] * 51
for i in range(1, 51):
	f[i] = f[i - 1] * i

def comb(n, r):
	return f[n] // f[r] // f[n - r]
print(sum(v[:A]) / A)
a = v[:A].count(v[A - 1])
b = v[A:].count(v[A - 1]) + a
ans = comb(b, a)
if a == A:
	for k in range(A + 1, B + 1):
		ans += comb(b, k)
print(ans)


import collections
import math
(N, A, B) = list(map(int, input().split()))
v = list(map(int, input().split()))
d = list(reversed(sorted(v)))
c = collections.Counter(v)
start = A
end = A
if c[d[0]] >= A:
	end = min(c[d[0]], B)
ans = 0
ans_com = 0
for i in range(start, end + 1):
	sel = i
	com = 1
	total = 0
	for j in range(len(d)):
		p = c[d[j]]
		com *= math.factorial(p)
		total += d[j] * p
		if sel <= p:
			com /= math.factorial(sel) * math.factorial(p - sel)
			total -= d[j] * (p - sel)
			break
		sel -= p
	ave = total / i
	ans = ave
	ans_com += int(com)
print(ans)
print(ans_com)


(N, A, B) = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
all_n = l.count(l[0])
from scipy.special import comb
from collections import Counter
l2 = l[0:A]
l_c = Counter(l)
max_mean = sum(l2) / A
l2 = Counter(l2).items()
print(max_mean)
ans = 1
if l[0] == l[A - 1]:
	ans = 0
	for i in range(A, B + 1):
		ans += comb(all_n, i, exact=True)
	print(ans)
	return
for (i, j) in l2:
	ans *= comb(l_c[i], j, exact=True)
print(ans)


from math import factorial

def comb(n, r):
	if n - r < 0:
		return 0
	return factorial(n) // (factorial(r) * factorial(n - r))
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
mod = 10 ** 9 + 7
v.sort(reverse=True)
x = v[a - 1]
cnt = 0
s = 0
for i in range(n):
	if x == v[i]:
		cnt += 1
	if x < v[i]:
		s = i + 1
ans = 0
print(sum(v[:a]) / a)
if v[0] == v[a - 1]:
	for i in range(a, min(cnt + 1, b + 1)):
		ans += comb(cnt, i)
	print(ans)
else:
	ans = comb(cnt, a - s)
	print(ans)


from math import factorial
from collections import defaultdict

def nCr(n, r):
	return int(factorial(n) / (factorial(n - r) * factorial(r)))
(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
dict = defaultdict(int)
for i in V:
	dict[i] += 1
V.sort(reverse=True)
v = []
value = 0
tmp = 0
for i in range(N):
	if value != V[i]:
		tmp = 1
		value = V[i]
	else:
		tmp += 1
	v.append([V[i], tmp])
ans = 0
print(sum(V[:A]) / A)
if V[0] == V[A - 1]:
	for i in range(A, B + 1):
		if V[0] == V[i - 1]:
			ans += nCr(dict[V[0]], i)
	print(ans)
else:
	print(nCr(dict[V[A - 1]], v[A - 1][1]))


def d_maximum_average_sets():
	from functools import reduce
	(N, A, B) = [int(i) for i in input().split()]
	V = sorted([int(i) for i in input().split()], reverse=True)

	def combination(n, r):
		numerator = reduce(lambda x, y: x * y, range(n, n - r, -1))
		denominator = reduce(lambda x, y: x * y, range(1, r + 1))
		return numerator // denominator
	if V[0] == V[A - 1]:
		x = V.count(V[0])
		count = sum([combination(x, i) for i in range(A, B + 1)])
	else:
		v_min = V[A - 1]
		(x, a) = (V.count(v_min), V[:A].count(v_min))
		count = combination(x, a)
	return '{}\n{}'.format(sum(V[:A]) / A, count)
print(d_maximum_average_sets())


def ncr(n, r):
	res = 1
	for k in range(r):
		res *= n - k
		res //= k + 1
	return res
(n, a, b) = [int(x) for x in input().split(' ')]
v = [int(x) for x in input().split(' ')]
v.sort(reverse=True)
su = 0
avg = 0
for x in v[:a]:
	su += x
avg = su / a
comb = 0
cnt1 = v.count(v[a - 1])
cnt2 = v[:a].count(v[a - 1])
if v[0] == v[a - 1]:
	for (i, vi) in enumerate(v[a - 1:b]):
		if vi == v[a - 1]:
			comb += ncr(cnt1, cnt2 + i)
else:
	comb = ncr(cnt1, cnt2)
print(avg)
print(comb)


(n, a, b) = map(int, input().split())
v = [int(i) for i in input().split()]
v.sort(reverse=True)
m = v[a - 1]
mm = v.count(m)
cnt = 0
for i in range(n):
	if v[i] > m:
		cnt += 1
	else:
		break

def fact(n):
	if n == 0 or n == -1:
		return 1
	return fact(n - 1) * n

def comb(n, k):
	return fact(n) // fact(n - k) // fact(k)
ans = 0
for i in range(min(mm + cnt - a, b - a + cnt) + 1):
	ans += comb(mm, a - cnt + i)
if m != v[0]:
	ans = comb(mm, a - cnt)
print(sum(v[0:a]) / a)
print(ans)


import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
dp = [-1] * (N + 1)
dp[0] = 0
cnt = [0] * (N + 1)
cnt[0] = 1
for i in range(N):
	for j in range(N, 0, -1):
		if dp[j - 1] < 0:
			continue
		if dp[j] < dp[j - 1] + V[i]:
			dp[j] = dp[j - 1] + V[i]
			cnt[j] = cnt[j - 1]
		elif dp[j] == dp[j - 1] + V[i]:
			cnt[j] += cnt[j - 1]
up = -1
btm = -1
s = 0
for i in range(A, B + 1):
	if dp[i] < 0:
		continue
	if up < 0:
		(up, btm) = (dp[i], i)
		s = cnt[i]
	elif up * i < dp[i] * btm:
		(up, btm) = (dp[i], i)
		s = cnt[i]
	elif up * i == dp[i] * btm:
		s += cnt[i]
print(up / btm)
print(s)


from math import factorial as fact

def comb(n, r):
	return fact(n) // (fact(r) * fact(n - r))
(n, a, b) = map(int, input().split())
vl = list(map(int, input().split()))
vl.sort(reverse=True)
res_avg = sum(vl[:a]) / a
res_cnt = 0
last_v = vl[a - 1]
cnt_all = 0
for v in vl:
	if v == last_v:
		cnt_all += 1
for m in range(a, b + 1):
	if sum(vl[:m]) / m == res_avg:
		cnt_in = 0
		for i in range(m):
			if last_v == vl[i]:
				cnt_in += 1
		res_cnt += comb(cnt_all, cnt_in)
print('{:6f}'.format(res_avg))
print(res_cnt)


(N, A, B) = map(int, input().split())
vlist = list(map(int, input().split()))
vlist.sort(reverse=True)
dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
	for j in range(1, N + 1):
		dp[i][j] = dp[i - 1][j]
		dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + vlist[i - 1])
max_value_avg = 0
for j in range(A, B + 1):
	value_avg = dp[-1][j] / j
	max_value_avg = max(max_value_avg, value_avg)
max_avg_size = []
for j in range(A, B + 1):
	value_avg = dp[-1][j] / j
	if value_avg == max_value_avg:
		max_avg_size.append(j)

def comb(n, r):
	r = min(r, n - r)
	nPr = 1
	fact_r = 1
	for i in range(r):
		nPr *= n - i
		fact_r *= r - i
	return nPr // fact_r
answer = 0
for m in max_avg_size:
	border = vlist[m - 1]
	n1 = n2 = n3 = 0
	for v in vlist:
		if v > border:
			n1 += 1
		elif v == border:
			n2 += 1
		else:
			n3 += 1
	answer += comb(n2, m - n1)
print(max_value_avg)
print(answer)


(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
print(sum(v[:a]) / a)
import math

def cmb(n, r):
	f = math.factorial
	return int(f(n) // f(r) // f(n - r))
(x, y) = (v.count(v[a - 1]), v[:a].count(v[a - 1]))
if v[0] == v[a - 1]:
	ans = sum((cmb(x, i) for i in range(a, min(b, x) + 1)))
else:
	ans = cmb(x, y)
print(ans)


(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
ave = lambda a: sum(a) / len(a)
a = []
INF = int(1000000000.0)

def C(n, m):
	ret = 1
	for i in range(m):
		ret *= n - i
	for i in range(2, m + 1):
		ret //= i
	return ret
for i in range(A, B + 1):
	a.append((ave(v[:i]), i))
(ans1, i) = max(a)
ans2 = 0
for (b, j) in a:
	if b != ans1:
		continue
	c1 = v[:j].count(v[j - 1])
	c2 = v.count(v[j - 1])
	ans2 += C(c2, c1)
print(ans1)
print(ans2)


FACT = [1] * 51
for i in range(1, 51):
	FACT[i] = FACT[i - 1] * i

def combination(n, r):
	return FACT[n] // FACT[r] // FACT[n - r]

def main():
	(N, A, B) = map(int, input().split())
	V = list(map(int, input().split()))
	V.sort(reverse=True)
	print(sum(V[:A]) / A)
	x = V[A - 1]
	y = V.count(x)
	ans = 0
	begin = V[:A].count(x)
	end = V[:B].count(x) + 1
	for i in range(begin, end):
		if i != begin and x != V[0]:
			continue
		ans += combination(y, i)
	print(ans)
main()


def com(n, k):
	P = [1]
	for i in range(1, n + 1):
		P.append(P[i - 1] * i)
	return P[n] / P[n - k] / P[k]
(N, A, B) = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse=True)
su = 0
for i in range(A):
	su += v[i]
ac = 0
t = v[A - 1]
k = 100
for i in range(N):
	if v[i] == t:
		ac += 1
		k = min(k, i)
print(su / A)
if k == 0:
	ans = 0
	for i in range(A, min(B, ac) + 1):
		ans += com(ac, i)
	print(int(ans))
else:
	print(int(com(ac, A - k)))


def comb(a, b):
	import math
	return math.factorial(a) // (math.factorial(a - b) * math.factorial(b))
from itertools import accumulate
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=1)
va = v[:A]
maxa = sum(va) / A
maxsum = sum(va)
print(maxa)
count = 1
if va[0] == va[-1]:
	v0 = va[0]
	v0c = v.count(v0)
	ans = comb(v0c, A)
	for i in range(A, B):
		if v[i] == v0:
			ans += comb(v0c, i + 1)
	print(ans)
else:
	v1 = va[-1]
	v1c = va.count(v1)
	v1c2 = v.count(v1)
	print(comb(v1c2, v1c))


(N, A, B) = map(int, input().split())
v = [int(i) for i in input().split()]
v.sort()
v.reverse()
print('{:.7f}'.format(sum(v[0:A]) / A))
cnt = 0
target = v[A - 1]
first = -1
for (i, vv) in enumerate(v):
	if vv == target:
		if first == -1:
			first = i
		cnt += 1

def comb(n, r):
	import math
	return math.factorial(n) // math.factorial(r) // math.factorial(n - r)
if first == 0:
	ans = 0
	for i in range(A, min(cnt, B) + 1):
		ans += comb(cnt, i)
	print(ans)
else:
	print(comb(cnt, A - first))


(N, A, B) = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort()
v = v[::-1]
a = v[A - 1]
is_first = True
end = -1
for i in range(N):
	if v[i] == a:
		if is_first:
			first = i
			is_first = False
	elif not is_first:
		end = i
		break

def comb(n, k):
	a = 1
	b = 1
	for i in range(min(n - k, k)):
		a *= n - i
		b *= i + 1
	return a // b
if end == -1:
	end = N
if first == 0:
	print(a)
	print(sum([comb(end, i) for i in range(A, min(B, end) + 1)]))
else:
	print(sum(v[:A]) / A)
	print(comb(end - first, A - first))


import collections
from math import factorial

def comb(n, r):
	return factorial(n) // factorial(n - r) // factorial(r)
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
c = collections.Counter(v)
k = min(v[:a])
if c[max(v)] < a:
	ans = comb(c[k], v[:a].count(k))
else:
	ans = 0
	for i in range(a, min(b, c[k]) + 1):
		ans += comb(c[k], i)
print(sum(v[:a]) / a)
print(ans)


from math import factorial

def getlist():
	return list(map(int, input().split()))
(N, A, B) = getlist()
v = sorted(getlist())
ans1 = 0
for i in range(A):
	ans1 += v[-1 - i]
ans1 = ans1 / A
print(ans1)
if v[-1] != v[-A]:
	i = 0
	while True:
		if v[-A + i] == v[-A]:
			i += 1
		else:
			break
	ans2 = factorial(v.count(v[-A])) // factorial(i) // factorial(v.count(v[-A]) - i)
else:
	ans2 = 0
	n = v.count(v[-1])
	for i in range(A, B + 1):
		if v[-i] == v[-A]:
			ans2 += factorial(n) // factorial(n - i) // factorial(i)
		else:
			break
print(int(ans2))


from collections import Counter
from math import factorial
(N, A, B) = list(map(int, input().split()))
V = list(map(int, input().split()))
V.sort(reverse=True)
c = Counter(V)
ans = []
L = []
for i in range(A, B + 1):
	ans.append(sum(V[0:i]) / i)
max_ans = max(ans)
print('{:.6f}'.format(max_ans))
num = 0
for j in range(B - A + 1):
	tmp = 1
	if ans[j] == max_ans:
		k = V[:A + j]
		cnt_k = Counter(k)
		for (key, value) in list(cnt_k.items()):
			tmp *= factorial(c[key]) // factorial(value) // factorial(c[key] - value)
		num += tmp
print(num)


(n, a, b) = map(int, input().split())
al = list(map(int, input().split()))
newal = sorted(al, reverse=True)
ave = 0
ml = []
for i in range(a, b + 1):
	avet = sum(newal[:i]) / i
	if avet >= ave:
		ml.append(i)
		ave = max(ave, avet)
print(ave)
import collections
c = collections.Counter(al)
from operator import mul
from functools import reduce

def cmb(n, r):
	r = min(n - r, r)
	if r == 0:
		return 1
	over = reduce(mul, range(n, n - r, -1))
	under = reduce(mul, range(1, r + 1))
	return over // under
res = 0
for j in ml:
	r = c[newal[j - 1]]
	rr = newal.index(newal[j - 1])
	res += cmb(r, j - rr)
print(res)


(n, a, b) = map(int, input().split())
vs = sorted([int(v) for v in input().split()], reverse=True)
print(sum(vs[:a]) / a)
binom = [1]
for k in range(vs.count(vs[a - 1])):
	binom = [x + y for (x, y) in zip(binom + [0], [0] + binom)]
if vs[a - 1] == vs[0]:
	print(sum(binom[a:b + 1]))
else:
	print(binom[a - vs.index(vs[a - 1])])


def factorial(n):
	if n == 1 or n == 0:
		return int(1)
	return int(n * factorial(n - 1))

def nck(n, k):
	return int(factorial(n) / (factorial(n - k) * factorial(k)))
ans = 0
ans2 = 0
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
for i in range(A, B + 1):
	ans = max(ans, sum(v[N - i:N]) / i)
print('{:.7f}'.format(ans))
for i in range(A, B + 1):
	if ans == sum(v[N - i:N]) / i:
		n = v.count(v[N - i])
		k = i - len([p for p in v if p > v[N - i]])
		ans2 += nck(n, k)
print(int(ans2))


def comb(n, r):
	if n < r:
		return 0
	ret = 1
	for i in range(1, r + 1):
		ret = ret * (n - i + 1) // i
	return ret
(n, a, b) = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse=True)
ave = sum(v[:a]) / a
if v[0] == v[a - 1]:
	sm = v.count(v[0])
	cnt = 0
	for i in range(a, b + 1):
		cnt += comb(sm, i)
else:
	last = v[a - 1]
	select = v[:a].count(last)
	sm = v.count(last)
	cnt = comb(sm, select)
print(ave)
print(cnt)


from operator import mul
from functools import reduce

def nCr(n, r):
	r = min(n - r, r)
	if r == 0:
		return 1
	over = reduce(mul, range(n, n - r, -1))
	under = reduce(mul, range(1, r + 1))
	return over // under
(n, a, b) = (int(x) for x in input().split())
V = list((int(x) for x in input().split()))
V.sort(reverse=True)
avg = sum(V[:a]) / a
k = V[:a].count(V[a - 1])
m = V.count(V[a - 1])
if k == a:
	ans = sum((nCr(m, i) for i in range(k, min(m, b) + 1)))
else:
	ans = nCr(m, k)
print(avg)
print(ans)


import math
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
c = 0

def comb(N, R):
	if N < R:
		return 0
	return math.factorial(N) // (math.factorial(N - R) * math.factorial(R))
if len(set(v[:a])) == 1:
	x = v[:a][0]
	d = 0
	for i in v:
		if i == x:
			d += 1
	for i in range(a, min(d + 1, b + 1)):
		c += comb(d, i)
	print(x)
	print(c)
else:
	x = v[:a][0]
	y = sorted(v[:a])
	av = sum(v[:a]) / a
	z = y[0]
	d = 0
	for i in v:
		if i == z:
			d += 1
	e = 0
	for i in y:
		if i == z:
			e += 1
	c = comb(d, e)
	print(av)
	print(c)


import math
import functools

def C(n, r):
	f = math.factorial
	return int(f(n) // f(r) // f(n - r))
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
ave = sum(v[:a]) / a
(x, y) = (v.count(v[a - 1]), v[:a].count(v[a - 1]))
if v[0] == v[a - 1]:
	comb = sum([C(x, i) for i in range(a, min(b, x) + 1)])
else:
	comb = C(x, y)
print(ave)
print(comb)


from collections import Counter
import math
(n, a, b) = map(int, input().split())
v = sorted(list(map(int, input().split())))[::-1]
l = Counter(v)
su = 0
ko = 0

def C(a, b):
	return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))
for i in range(a, b + 1):
	v1 = v[:i]
	s = sum(v1) / i
	if su < s:
		su = s
		ko = C(l[v[a]], v1.count(v1[-1]))
	elif su == s:
		ko += C(l[v[a]], v1.count(v1[-1]))
print(su)
print(ko)


from bisect import bisect_right
(N, A, B) = map(int, input().split())
v = [int(i) for i in input().split()]
v.sort(reverse=True)

def comb(n, r):
	if n == 0 or r == 0:
		return 0
	ret = 1
	for i in range(1, n + 1):
		ret *= i
	for i in range(1, r + 1):
		ret //= i
	for i in range(1, n - r + 1):
		ret //= i
	return ret
print(sum(v[:A]) / A)
if v[A - 1] != v[0]:
	ret = 0
	a = v.count(v[A - 1])
	r = v[:A].count(v[A - 1])
	print(comb(a, r))
else:
	a = v.count(v[A - 1])
	ret = 0
	for i in range(A, min(B, a) + 1):
		ret += comb(a, i)
	print(ret)


import math

def nCr(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(n, a, b) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=True)
ans = 0
ma = sum(v[:a]) / a
for i in range(a, b + 1):
	ave = sum(v[:i]) / i
	if ave == ma:
		p = 1
		for j in set(v[:i]):
			p *= nCr(v.count(j), v[:i].count(j))
		ans += p
print(ma)
print(ans)


kai = [1]
s = 1
for i in range(1, 51):
	s *= i
	kai.append(s)
(n, a, b) = map(int, input().split())
vl = list(map(int, input().split()))
vl = sorted(vl)
member = vl[-a:]
ans = sum(vl[-a:]) / len(vl[-a:])
v = vl[-a]
m = vl.count(v)
k = member.count(v)
if member[0] == member[-1]:
	print(ans)
	ans2 = 0
	for i in range(a, min(b, m) + 1):
		ans2 += kai[m] // (kai[i] * kai[m - i])
	print(ans2)
else:
	print(ans)
	print(kai[m] // (kai[k] * kai[m - k]))


(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
fact = [1]
for i in range(1, 51):
	fact.append(i * fact[-1])

def cmb(n, r):
	return fact[n] // (fact[n - r] * fact[r])
v.sort(reverse=True)
print(sum(v[:a]) / a)
(cntv, cntr) = (0, 0)
for i in range(n):
	if i < a:
		if v[i] == v[a - 1]:
			cntv += 1
	elif v[i] == v[a - 1]:
		cntr += 1
if cntv < a:
	print(cmb(cntv + cntr, cntv))
else:
	ans = 0
	for r in range(a, min(b, cntv + cntr) + 1):
		ans += cmb(cntv + cntr, r)
	print(ans)


from fractions import Fraction

def choose(n, r):
	res = 1
	for i in range(r):
		res = res * (n - i) // (i + 1)
	return res
(n, a, b) = map(int, input().split())
vs = sorted(map(int, input().split()))
average_max = Fraction(sum(vs[n - a:]), a)
print('{0:.9f}'.format(float(average_max)))
res = 0
for m in range(a, b + 1):
	average = Fraction(sum(vs[n - m:]), m)
	if average < average_max:
		continue
	mn = min(vs[n - m:])
	res += choose(sum((1 for x in vs if x == mn)), sum((1 for x in vs[n - m:] if x == mn)))
print(res)


import math
(N, A, B) = map(int, input().split())
v = input().split()
for i in range(N):
	v[i] = int(v[i])
v.sort(reverse=True)
ans1 = 0
for i in range(A):
	ans1 += v[i]
ans1 /= A
print(ans1)
p = v[A - 1]
q = v.count(p)
r = v.index(p)
ans2 = 0
if not v[0] == v[A - 1]:
	ans2 = math.factorial(q) // math.factorial(q + r - A) // math.factorial(A - r)
else:
	for i in range(A, min(q, B) + 1):
		ans2 += math.factorial(q) // math.factorial(q - i) // math.factorial(i)
print(ans2)


(n, a, b) = map(int, input().split())
u = sorted(list(map(int, input().split())))[::-1]
v = sum(u[:a]) / a
print(v)
f = [1]
for i in range(50):
	f += [f[-1] * (i + 1)]
x = u.count(u[a - 1])
if u[0] == u[a - 1]:
	print(sum((f[x] // (f[x - i] * f[i]) for i in range(a, b + 1))))
else:
	y = u[:a].count(u[a - 1])
	print(f[x] // (f[x - y] * f[y]))


def COMB(a, b):
	if b > a - b:
		b = a - b
	ans = 1
	for i in range(0, b):
		ans *= a - i
	for i in range(0, b):
		ans //= b - i
	return int(ans)
(N, A, B) = map(int, input().split())
v_lst = [int(p) for p in input().split()]
v_lst.sort(reverse=True)
count = 0
for i in range(0, B - A + 1):
	lst = v_lst[0:A + i]
	mean = sum(lst) / len(lst)
	if i == 0:
		nxt_mean = mean
	if mean == nxt_mean:
		a = v_lst.count(min(lst))
		b = lst.count(min(lst))
		count += COMB(a, b)
	else:
		break
	nxt_mean = mean
print('{:.6f}'.format(nxt_mean))
print(count)


import math
(n, a, b) = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
x.reverse()
j = a + 1
moto = 0
h = 0
d = x[a - 1]
asd = 0
l = x.count(d)
for i in range(a):
	moto += x[i]
	if x[i] == x[a - 1]:
		h += 1
print(moto / a)
if moto / a == x[a - 1]:
	for i in range(a, b + 1):
		if l - i >= 0:
			asd += math.factorial(l) // (math.factorial(l - i) * math.factorial(i))
	print(asd)
else:
	print(math.factorial(l) // (math.factorial(l - h) * math.factorial(h)))


import math
(N, A, B) = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
dic = {}
for i in range(N):
	v = a[i]
	if v not in dic.keys():
		dic[v] = 1
	else:
		dic[v] += 1
tmp = 0
num_used = {}
m = 10 ** 18
M = -1
for i in range(A):
	v = a[i]
	m = min(m, v)
	M = max(M, v)
	tmp += v
	if v not in num_used.keys():
		num_used[v] = 1
	else:
		num_used[v] += 1
max_ave = tmp / A
print(max_ave)
if num_used[m] == dic[m]:
	print(1)
elif m == M:
	x = dic[m]
	y = num_used[m]
	cnt = 0
	for i in range(y, min(x + 1, B - A + y + 1)):
		cnt += math.factorial(x) // math.factorial(i) // math.factorial(x - i)
	print(cnt)
else:
	x = dic[m]
	y = num_used[m]
	cnt = math.factorial(x) // math.factorial(y) // math.factorial(x - y)
	print(cnt)


import math

def comb(n, k):
	return math.factorial(n) // (math.factorial(n - k) * math.factorial(k))
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
max_avg = sum(v[:a]) / a
min_v = min(v[:a])
ans = 0
for i in range(a, b + 1):
	if max_avg != sum(v[:i]) / i:
		break
	cnt1 = v[:i].count(min_v)
	cnt2 = v.count(min_v)
	ans += comb(cnt2, cnt1)
print(max_avg)
print(int(ans))


import math

def C(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(n, a, b) = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)
print(sum(l[:a]) / a)
if l.count(l[a - 1]) > 1:
	ans = 0
	x = l[a - 1]
	y = l[:a].count(x)
	z = l.count(x)
	if l[0] != x:
		print(C(z, y))
	else:
		ans = 0
		for i in range(a, min(b, z) + 1):
			ans += C(z, i)
		print(ans)
else:
	print(1)


from math import factorial
(N, A, B) = map(int, input().split())
V = sorted(list(map(int, input().split())), reverse=True)
print(sum(V[:A]) / A)
if V[0] == V[A - 1]:
	n = sum([1 for v in V if v == V[0]])
	print(sum([factorial(n) // factorial(r) // factorial(n - r) for r in range(A, min(n, B) + 1)]))
else:
	n = sum([1 for v in V if v == V[A - 1]])
	r = sum([1 for v in V[:A] if v == V[A - 1]])
	print(factorial(n) // factorial(r) // factorial(n - r))


from operator import mul
from functools import reduce

def sml_cmb(n, r):
	r = min(n - r, r)
	if r == 0:
		return 1
	over = reduce(mul, range(n, n - r, -1))
	under = reduce(mul, range(1, r + 1))
	return over // under

def main():
	(n, a, b) = map(int, input().split())
	v = list(map(int, input().split()))
	v.sort()
	ave = 0
	for i in range(1, a + 1):
		ave += v[n - i]
	ave /= a
	(l, r) = (-1, -1)
	target = v[n - a]
	for i in range(n):
		if v[i] == target:
			l = i
			break
	for i in reversed(range(n)):
		if v[i] == target:
			r = i
			break
	cnt = r - l + 1
	(high, low) = (min(cnt, r - (n - b) + 1), r - (n - a) + 1)
	ans = sml_cmb(cnt, low)
	if v[n - a] == v[n - 1]:
		for i in range(low + 1, high + 1):
			ans += sml_cmb(cnt, i)
	print(ave)
	print(ans)

def __starting_point():
	main()
__starting_point()


def inpl():
	return [int(i) for i in input().split()]

def comb(a, b):
	return math.factorial(a) // math.factorial(a - b) // math.factorial(b)
(N, A, B) = inpl()
V = inpl()
V = list(reversed(sorted(V)))
x1 = N - 1
x2 = 0
for i in range(N):
	if V[i] == V[A]:
		x1 = min(x1, i)
		x2 = max(x2, i)
print(sum(V[0:A]) / A)
import math
ans = 0
if x1 == 0:
	for l in range(A - 1, min(B, x2 + 1)):
		ans += comb(x2 - x1 + 1, l - x1 + 1)
	print(ans)
else:
	print(comb(x2 - x1 + 1, A - x1))


from math import factorial
from collections import Counter

def cmb(n, r):
	return factorial(n) // (factorial(n - r) * factorial(r))
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
l = Counter(v)
avg = 0
cnt = 0
for i in range(A, B + 1):
	tmp = sum(v[:i]) / i
	if tmp > avg:
		avg = tmp
		cnt = cmb(l[v[A - 1]], v[:i].count(v[i - 1]))
	elif tmp == avg:
		cnt += cmb(l[v[A - 1]], v[:i].count(v[i - 1]))
print(avg)
print(cnt)


(N, A, B) = map(int, input().split())
X = list(map(int, input().split()))
X.sort(reverse=True)
M = sum((X[i] for i in range(A))) / A
print(M)
(cntl, cntr) = (0, 0)
if X[A - 1] == X[N - 1]:
	cntr = N - A
else:
	cntr = A - 1
	while X[A - 1] == X[cntr]:
		cntr += 1
	cntr -= A
if X[0] == X[A - 1]:
	cntl = A
else:
	cntl = A - 1
	while X[A - 1] == X[cntl]:
		cntl -= 1
	cntl = A - 1 - cntl
F = 0
c = cntl + cntr
if cntl == A:
	t = 1
	for m in range(A):
		t *= c - m
		t //= m + 1
	for m in range(A, min(B, c) + 1):
		F += t
		t *= c - m
		t //= m + 1
	print(F)
else:
	t = 1
	for m in range(cntl):
		t *= c - m
		t //= m + 1
	F = t
	print(F)


import collections
from operator import mul
from functools import reduce
(N, A, B) = list(map(int, input().split()))
V = list(map(int, input().split()))
VV = sorted(V, reverse=True)
ave = 0
ml = []
for i in range(A, B + 1):
	avet = sum(VV[:i]) / i
	if avet >= ave:
		ml.append(i)
		ave = max(ave, avet)
	else:
		break
dic = collections.Counter(V)

def cmb(n, r):
	r = min(n - r, r)
	if r == 0:
		return 1
	over = reduce(mul, list(range(n, n - r, -1)))
	under = reduce(mul, list(range(1, r + 1)))
	return over // under
res = 0
for j in ml:
	r = dic[VV[j - 1]]
	rr = VV.index(VV[j - 1])
	res += cmb(r, j - rr)
print(ave)
print(res)


def combinations(n, r):
	res = 1
	for i in range(n - r + 1, n + 1):
		res *= i
	for i in range(2, r + 1):
		res //= i
	return res
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
ans1 = sum(v[0:A]) / A
num1 = v[0:A].count(v[A - 1])
num2 = v[A:N].count(v[A - 1])
ans2 = 0
if v[0] == v[A]:
	for i in range(A, N):
		if v[i] == v[A]:
			idx = i + 1
	for i in range(A, min(B, idx) + 1):
		ans2 += combinations(num1 + num2, i)
else:
	ans2 = combinations(num1 + num2, num1)
print(ans1)
print(ans2)


import math
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v = sorted(v, key=lambda x: -x)
need = v[:a]
ti = min(need)
no = need.count(ti)
try:
	ona = v[a:].count(ti)
except:
	ona = 0
if ona == 0:
	print(sum(need) / a)
	print(1)
elif no == a:
	ans = 0
	for i in range(b + 1 - a):
		if ona == -1:
			break
		ans += math.factorial(ona + no) / math.factorial(ona) / math.factorial(no)
		ona -= 1
		no += 1
	print(sum(need) / a)
	print(int(ans))
else:
	print(sum(need) / a)
	print(int(math.factorial(ona + no) / math.factorial(ona) / math.factorial(no)))


import math
(N, A, B) = map(int, input().split())
lst = list(map(int, input().split()))
lst.sort()
a = lst[-A:]
print(sum(a) / A)
b = lst.count(a[0])
c = a.count(a[0])
if c != A:
	print(int(math.factorial(b) / (math.factorial(c) * math.factorial(b - c))))
else:
	l = []
	i = min([b - c, B - A])
	for k in range(0, i + 1):
		l.append(math.factorial(b) / (math.factorial(c + k) * math.factorial(b - c - k)))
	print(int(sum(l)))


from math import factorial
(n, a, b) = map(int, input().split())
V = sorted(map(int, input().split()), reverse=True)
av = sum(V[:a]) / a
print(av)

def comb(m, k):
	ans = 1
	if k == 0:
		return 1
	else:
		for i in range(k):
			ans *= m - i
			ans //= i + 1
		return ans
num = V[a]
m = V.count(num)
k = V[:a].count(num)
if a != k:
	ans = factorial(m) // (factorial(k) * factorial(m - k))
else:
	ans = 0
	for k in range(a, b + 1):
		ans += comb(m, k)
print(ans)


def comb(x, y):
	s = 1
	for i in range(y):
		s = s * (x - i) // (i + 1)
	return s
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=1)
m = v[a - 1]
l = -1
while v[l + 1] > m:
	l += 1
r = a - 1
while r + 1 <= n - 1 and v[r + 1] == m:
	r += 1
print(sum(v[:a]) / a)
ans = 0
if l == -1:
	for k in range(a, b + 1):
		ans += comb(r - l, k - 1 - l)
else:
	ans += comb(r - l, a - 1 - l)
print(ans)


import sys
from collections import Counter

def factorial(n):
	fact = 1
	for integer in range(1, n + 1):
		fact *= integer
	return fact
(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
c1 = Counter(V)
V.sort(reverse=True)
if all([V[0] == i for i in V[:A]]):
	print(V[0])
	ans = 0
	for i in range(A - 1, B):
		if V[i] != V[0]:
			break
		ans += factorial(c1[V[0]]) // (factorial(c1[V[0]] - (i + 1)) * factorial(i + 1))
	print(ans)
	return
print(sum(V[:A]) / A)
c2 = Counter(V[:A])
print(factorial(c1[V[A - 1]]) // (factorial(c1[V[A - 1]] - c2[V[A - 1]]) * factorial(c2[V[A - 1]])))


from math import factorial
from collections import Counter
(n, a, b) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=True)
ma = sum(v[:a]) / a
print(ma)
cnt = Counter(v)
if v[a - 1] == v[0]:
	m = cnt[v[0]]
	ans = 0
	for i in range(a, min(b, m) + 1):
		ans += factorial(m) // (factorial(i) * factorial(m - i))
	print(ans)
else:
	m = cnt[v[a - 1]]
	r = Counter(v[:a])[v[a - 1]]
	print(factorial(m) // (factorial(r) * factorial(m - r)))


from collections import Counter
from math import factorial as F
(N, A, B) = map(int, input().split())
V = sorted(list(map(int, input().split())), reverse=True)
C = Counter(V)
SUM = 0
LN = [0, 0]
for i in range(A):
	if V[i] == LN[0]:
		LN[1] += 1
	else:
		LN[0] = V[i]
		LN[1] = 1
	SUM += V[i]
AVE = SUM / A
comb = 0
n = C[LN[0]]
if LN[1] == A:
	for r in range(A, min(n, B) + 1):
		comb += F(n) // (F(n - r) * F(r))
else:
	comb = F(n) // (F(n - LN[1]) * F(LN[1]))
print('{0:.6f}'.format(AVE))
print(comb)


def ncr(n, r):
	g = 1
	for i in range(1, r + 1):
		g *= n - r + i
		g //= i
	return g
(n, a, b) = map(int, input().split())
nv = sorted(list(map(int, input().split())), reverse=True)
print(sum(nv[:a]) / a)
ndica = {}
ndicfull = {}
conti = 0
fnv = nv[0]
for (i, temp) in enumerate(nv):
	if i < a:
		ndica[temp] = ndica.get(temp, 0) + 1
	ndicfull[temp] = ndicfull.get(temp, 0) + 1
	if temp == fnv:
		conti = i + 1
if fnv == nv[a - 1]:
	subb = min(conti, b)
	g = 0
	for t in range(a, subb + 1):
		g += ncr(conti, t)
	print(g)
elif ndicfull[nv[a - 1]] == 1:
	print(1)
else:
	print(ncr(ndicfull[nv[a - 1]], ndica[nv[a - 1]]))


import math

def comb(n, m):
	fact = math.factorial
	return fact(n) // fact(m) // fact(n - m)
(N, A, B) = map(int, input().split())
val = list(reversed(sorted(map(int, input().split()))))
ret = 0
prev = [0, 1]
for i in range(A, B + 1):
	cur = [sum([val[j] for j in range(i)]), i]
	if i > A and prev[0] * cur[1] > prev[1] * cur[0]:
		break
	ret += comb(val.count(val[i - 1]), val[:i].count(val[i - 1]))
	prev = cur
print(format(prev[0] / prev[1], '.12f'))
print(ret)


import sys
input = sys.stdin.readline
(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
ans1 = sum(V[:A]) / A
ans2 = 1
cnt = V.count(V[0])
if cnt > A:
	ans2 = 0
	for i in range(A, min(B, cnt) + 1):
		tmp = 1
		for j in range(i):
			tmp *= cnt - j
			tmp //= j + 1
		ans2 += tmp
else:
	cnt1 = V.count(V[A - 1])
	cnt2 = V[:A].count(V[A - 1])
	if cnt1 > 1:
		for i in range(cnt2):
			ans2 *= cnt1 - i
			ans2 //= i + 1
print(ans1)
print(ans2)


comb_memo = {}

def comb(n, r):
	nonlocal comb_memo
	if (n, r) in comb_memo:
		return comb_memo[n, r]
	else:
		r = min(r, n - r)
		res = 1
		for _ in range(r):
			res *= n
			n -= 1
		for i in range(1, r + 1):
			res //= i
		comb_memo[n, r] = res
		comb_memo[n, n - r] = res
		return res
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
mu = sum(v[:A]) / A
ans = 0
if v[0] == mu:
	R = v.count(v[0])
	for i in range(A, B + 1):
		if i > R:
			break
		ans += comb(R, i)
else:
	min_v = v[A - 1]
	n = v.count(min_v)
	need = v[:A].count(min_v)
	ans += comb(n, need)
print(mu)
print(ans)


(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
count = {}
for x in v:
	if x in count:
		count[x] += 1
	else:
		count[x] = 1
fact = [1] * 51
for i in range(1, 51):
	fact[i] = fact[i - 1] * i

def comb(a, b):
	return fact[a] // fact[a - b] // fact[b]
ans = 0
if v[0] == v[a - 1]:
	b = min(b, count[v[0]])
	for i in range(a, b + 1):
		ans += comb(count[v[0]], i)
	print(v[0])
	print(ans)
else:
	c = v[:a].count(v[a - 1])
	print(sum(v[:a]) / a)
	print(comb(count[v[a - 1]], c))


(N, A, B) = map(int, input().split())
val = [int(i) for i in input().split()]

def combi(n, m):
	from math import factorial
	return factorial(n) // (factorial(m) * factorial(n - m))
val.sort(reverse=True)
ave = sum(val[:A]) / A
l = val.index(val[A - 1])
x = val.count(val[A - 1])
ct = 0
if val[0] == val[A - 1]:
	for i in range(A, x + 1):
		if i > B:
			break
		else:
			ct += combi(x, i)
else:
	ct = combi(x, A - l)
print(ave)
print(ct)


from statistics import mean
from collections import Counter
(n, a, b) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=True)
avg = mean(v[:a])
print(avg)
p = Counter(v[:a])[v[a - 1]]
q = Counter(v)[v[a - 1]]

def n_func(n):
	ans = 1
	for i in range(1, n + 1):
		ans = ans * i
	return ans

def nCr(n, r):
	return n_func(n) // n_func(r) // n_func(n - r)
if v[0] == v[a - 1]:
	print(sum([nCr(q, a + i) for i in range(0, min(b, q) - a + 1)]))
else:
	print(nCr(q, p))


import math
(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
print(sum(v[0:A]) / A)
cnt = v.count(v[0])
cnt2 = v.count(v[A - 1])
V = v[0:A]
cnt3 = V.count(v[A - 1])

def combinations_count(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
if cnt < A:
	print(combinations_count(cnt2, cnt3))
elif cnt == A:
	print(1)
elif cnt > A:
	ans = 0
	for i in range(A, min(cnt + 1, B + 1)):
		ans += combinations_count(cnt, i)
	print(ans)


(N, A, B) = map(int, input().split())
v = sorted(list(map(int, input().split())), reverse=True)
print(sum(v[:A]) / A)
x = v.count(v[A - 1])
y = v[:A].count(v[A - 1])
if v[0] != v[A - 1]:
	u = 1
	d = 1
	for i in range(x, x - y, -1):
		u *= i
	for i in range(y, 0, -1):
		d *= i
	print(u // d)
else:
	ans = 0
	for i in range(A, min(B, x) + 1):
		u = 1
		d = 1
		for j in range(x, x - i, -1):
			u *= j
		for j in range(i, 0, -1):
			d *= j
		ans += u // d
	print(ans)


import sys
input = sys.stdin.readline

def main():
	(N, A, B) = map(int, input().split())
	v = sorted(list(map(int, input().split())), reverse=True)
	use = v[:A]
	print(sum(use) / A)
	fac = [0 for _ in range(N + 1)]
	(fac[0], fac[1]) = (1, 1)
	for i in range(2, N + 1):
		fac[i] = fac[i - 1] * i
	x = v.count(v[A - 1])
	y = use.count(use[A - 1])
	if v[0] == v[A - 1]:
		ans = 0
		for i in range(A, min(B, x) + 1):
			ans += fac[x] // (fac[i] * fac[x - i])
		print(ans)
	else:
		ans = fac[x] // (fac[y] * fac[x - y])
		print(ans)
main()


(n, a, b) = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
import math

def combinations_count(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans = 0
x = 0
y = 0
for i in range(n):
	if i <= a - 1:
		ans += V[i]
		if V[i] == V[a - 1]:
			x += 1
			y += 1
	elif V[i] == V[a - 1]:
		x += 1
if V[0] != V[a - 1]:
	cnt = combinations_count(x, y)
	print(ans / a)
	print(cnt)
else:
	cnt = 0
	for i in range(a, b + 1):
		if i <= x:
			cnt += combinations_count(x, i)
	print(ans / a)
	print(cnt)


import bisect
from math import factorial

def comb_cnt(n, r):
	return factorial(n) // (factorial(n - r) * factorial(r))
(n, a, b) = list(map(int, input().split()))
vs = list(map(int, input().split()))
vs.sort()
maxsum = sum(vs[-a:])
val = vs[-a]
(l, r) = (bisect.bisect_left(vs, val), bisect.bisect_right(vs, val))
(nmin, nmax) = (r - (n - a), r - max(l, n - b))
if r != n:
	ans = comb_cnt(r - l, nmin)
else:
	ans = 0
	for i in range(nmin, nmax + 1):
		ans += comb_cnt(r - l, i)
print(maxsum / a)
print(ans)


from math import factorial as f

def comb(n, k):
	return f(n) // f(k) // f(n - k)
(n, a, b) = map(int, input().split())
V = sorted(map(int, input().split()))
s = sum(V[-a:]) / a
print(s)
small = V[-a]
cnt = V[-a:].count(small)
total = V.count(small)
if V[-1] != small:
	ans = comb(total, cnt)
else:
	ans = 0
	for i in range(a, min(b, total) + 1):
		ans += comb(total, i)
print(ans)


(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=1)
s = sum(v[:A])
print(s / A)
from math import factorial
t = v[A - 1]
(p, q) = (0, 0)
for i in v:
	if i > t:
		p += 1
	elif i == t:
		q += 1
a = 0

def c(n, k):
	return factorial(n) // factorial(k) // factorial(n - k)
for i in range(A, B + 1):
	if p + q >= i:
		a += c(q, i - p)
	if t != v[0]:
		break
print(a)


(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
v = v[::-1]
print(sum(v[:a]) / a)

def com(x, y):
	a = 1
	b = 1
	y = min(y, x - y)
	for i in range(x, x - y, -1):
		a *= i
	for i in range(1, y + 1):
		b *= i
	return a // b
ans = 0
x = v.count(v[a - 1])
y = v[:a].count(v[a - 1])
if v[0] != v[a]:
	ans += com(x, y)
else:
	for j in range(a, min(b, x) + 1):
		ans += com(x, j)
print(ans)


(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
C = [[1 for k in range(n + 1)] for n in range(N + 1)]
for n in range(2, N + 1):
	for k in range(1, n):
		C[n][k] = C[n - 1][k] + C[n - 1][k - 1]
x = v[A - 1]
l = 0
while v[l] != x:
	l += 1
r = l + 1
while r < N and v[r] == x:
	r += 1
count = 0
for i in range(A, min(B, r) + 1):
	if sum(v[:A]) * i == sum(v[:i]) * A:
		count += C[r - l][i - l]
print(sum(v[:A]) / A)
print(count)


def comb(n, r):
	(x, y) = (1, 1)
	for i in range(n, n - r, -1):
		x *= i
		y *= i + r - n
	return x // y
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
c = b - a + 1
s = [0] * c
for i in range(c):
	s[i] = sum(v[0:a + i]) / (a + i)
m = max(s)
ans = 0
for i in range(c):
	if s[i] == m:
		r = v[0:a + i].count(v[a + i - 1])
		l = v.count(v[a + i - 1])
		ans += comb(l, min(r, l - r))
print(m)
print(ans)


import sys
readline = sys.stdin.readline
(N, A, B) = list(map(int, readline().split()))
V = list(map(int, readline().split()))
V = sorted(V, reverse=True)
print(sum(V[:A]) / A)
from scipy.special import comb
P = V[A - 1]
pcnt = V.count(P)
if V[0] == P:
	ans = 0
	for i in range(A, B + 1):
		ans += comb(pcnt, i, exact=True)
	print(ans)
else:
	pneed = V[:A].count(P)
	print(comb(pcnt, pneed, exact=True))


import math
from collections import Counter
(N, A, B) = list(map(int, input().split()))
V = list(map(int, input().split()))
V.sort(reverse=True)
c = Counter(V)
L = []
for i in range(A, B + 1):
	L.append(sum(V[0:i]) / i)
ans = []
for i in range(A, B + 1):
	c_t = Counter(V[0:i])
	tmp = 1
	for (k, v) in list(c_t.items()):
		tmp *= math.factorial(c[k]) // math.factorial(v) // math.factorial(c[k] - v)
	ans.append(tmp)
max_L = max(L)
num = 0
for i in range(len(L)):
	if L[i] == max_L:
		num += ans[i]
print('{:.6f}'.format(max_L))
print(num)


from statistics import mean
from math import factorial as fact
(n, a, b) = map(int, input().split())
v = sorted([int(x) for x in input().split()], reverse=True)
sel = v[:a]
print(mean(sel))
vn = v.count(sel[-1])
na = sel.count(sel[-1])
nb = min(b - a, vn - na)
if na != len(sel):
	print(fact(vn) // (fact(na) * fact(vn - na)))
elif nb == 0:
	print(1)
else:
	ret = 0
	for bi in range(na, na + nb + 1):
		ret += fact(vn) // (fact(bi) * fact(vn - bi))
	print(ret)


def conb(a, b):
	now = 1
	for i in range(b):
		now = int(now * (a - i) / (i + 1))
	return now
(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
line = V[A - 1]
if V[0] == line:
	ans = 0
	for i in range(A, min(V.count(V[0]), B) + 1):
		ans += conb(V.count(V[0]), i)
	print(V[0])
	print(ans)
elif line > V[A]:
	print(sum(V[:A]) / A)
	print(1)
else:
	idx = V.index(line)
	cnt = V.count(line)
	print((sum(V[:idx]) + line * (A - idx)) / A)
	print(conb(cnt, A - idx))


(n, a, b) = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
A = V[:a]
B = V[:b]
ave = sum(A) / a
print(ave)
C = [[0] * 51 for _ in range(51)]
C[0][0] = 1
for i in range(50):
	C[i + 1][0] = 1
	C[i + 1][i + 1] = 1
	for j in range(i):
		C[i + 1][j + 1] = C[i][j] + C[i][j + 1]
if A[0] == A[-1]:
	ans = 0
	x = V.count(A[0])
	for i in range(a, b + 1):
		if i <= x:
			ans += C[x][i]
else:
	x = V.count(A[-1])
	y = A.count(A[-1])
	ans = C[x][y]
print(ans)


from functools import lru_cache

@lru_cache
def comb(n, k):
	if k == 0:
		return 1
	elif n == k:
		return 1
	else:
		return comb(n - 1, k) + comb(n - 1, k - 1)
(N, A, B) = map(int, input().split())
vs = sorted(map(int, input().split()), reverse=True)
print(sum(vs[:A]) / A)
v_replaceable = vs[A]
n = vs.count(v_replaceable)
a = A - vs.index(v_replaceable)
b = min(n, B - vs.index(v_replaceable))
if vs[0] == v_replaceable:
	print(sum((comb(n, t) for t in range(a, b + 1))))
else:
	print(comb(n, a))


import bisect
import math
(N, A, B) = map(int, input().split())
v = sorted(list(map(int, input().split())))
ave = sum(v[-A:]) / A
print(ave)
leftA = bisect.bisect_left(v, v[-A])
rightA = bisect.bisect_right(v, v[-A])

def comb(n, r):
	return math.factorial(n) // math.factorial(r) // math.factorial(n - r)
ans = 0
if v[-A] == v[-1]:
	for i in range(A, min(rightA - leftA, B) + 1):
		ans += comb(rightA - leftA, i)
	print(ans)
else:
	print(comb(rightA - leftA, A + rightA - N))


import math
(n, a, b) = list(map(int, input().split()))
v = list(map(int, input().split()))
v.sort(reverse=True)
vave = 0
mi = 0
for i in range(a, b + 1):
	vsumi = sum(v[:i])
	vavei = vsumi / i
	if vave <= vavei:
		vave = vavei
		ci = v.count(v[i - 1])
		cin = v[:i].count(v[i - 1])
		m = math.factorial(ci) // math.factorial(cin) // math.factorial(ci - cin)
		mi += m
print(vave)
print(mi)


def combinations(N):
	comb = [[0] * (N + 1) for _ in range(N + 1)]
	comb[0][0] = 1
	for i in range(1, N + 1):
		for j in range(i + 1):
			comb[i][j] += comb[i - 1][j]
			if j > 0:
				comb[i][j] += comb[i - 1][j - 1]
	return comb
nCk = combinations(60)
(N, A, B, *V) = map(int, open(0).read().split())
V.sort(reverse=True)
num = V.count(V[A - 1])
ans = 0
if V[0] == V[A - 1]:
	for i in range(A, B + 1):
		ans += nCk[num][i]
else:
	a = V[:A].count(V[A - 1])
	ans = nCk[num][a]
ave = sum(V[:A]) / A
print('{:.9f}'.format(ave))
print(ans)


from math import factorial
import bisect

def cmb(n, r):
	if n < 0 or r < 0:
		return 0
	else:
		return factorial(n) // factorial(n - r) // factorial(r)
(n, a, b) = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
x.sort(reverse=True)
print(sum(x[:a]) / a)
if n == a:
	print(1)
elif x[0] == x[a]:
	for i in range(n):
		if x[0] != x[i]:
			k = i
			break
	else:
		k = n
	for i in range(a, min(k + 1, b + 1)):
		ans += cmb(k, i)
	print(ans)
elif x[a - 1] == x[a]:
	y = sorted(x)
	x1 = bisect.bisect_left(y, x[a])
	x2 = bisect.bisect_right(y, x[a])
	print(cmb(x2 - x1, a - (n - x2)))
else:
	print(1)


from collections import Counter

def nCr(n, r):
	return fac[n] // fac[r] // fac[n - r]
(N, A, B) = map(int, input().split())
v = sorted(map(int, input().split()), reverse=True)
fac = [1]
for i in range(N):
	fac.append(fac[-1] * (i + 1))
print(sum(v[:A]) / A)
c = Counter(v)
if v[0] == v[A - 1]:
	Cnt = c[v[0]]
	res = 0
	for i in range(A, B + 1):
		res += nCr(Cnt, i)
	print(res)
else:
	All = c[v[A - 1]]
	M = v[:A].count(v[A - 1])
	print(nCr(All, M))


(N, A, B) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
max_mean = sum(v[:A]) / A
print(max_mean)
from collections import Counter
from math import factorial

def comb(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))
v_count = Counter(v)
ans = 0
if v[0] == v[A - 1]:
	n = v_count[v[A - 1]]
	for r in range(A, B + 1):
		if r > n:
			break
		ans += comb(n, r)
else:
	n = v_count[v[A - 1]]
	select_count = Counter(v[:A])
	r = select_count[v[A - 1]]
	ans = comb(n, r)
print(ans)


(n, a, b) = map(int, input().split())
data = sorted(map(int, input().split()), reverse=True)
s = sum(data[:a])
k = a
last = data[a - 1]
p = sum(map(lambda x: x == last, data[:a]))
if data[0] == last:
	q = sum(map(lambda x: x == last, data[:b]))
else:
	q = p
z = sum(map(lambda x: x == last, data))
r = 1
res = 0
for i in range(q):
	r *= z - i
	r //= i + 1
	if i >= p - 1:
		res += r
print(s / k)
print(res)


def factrial(a):
	ans = 1
	for i in range(2, a + 1):
		ans *= i
	return ans

def comb(a, b):
	return factrial(a) / (factrial(a - b) * factrial(b))
(N, A, B) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
mean_ = sum(arr[:A]) / A
top = arr.index(arr[A - 1])
num = arr.count(arr[A - 1])
ans = 0
if arr[0] == arr[A - 1]:
	for i in range(A, min(num, B) + 1):
		ans += comb(num, i)
else:
	ans = comb(num, A - top)
print(mean_)
print(int(ans))


import math

def combi(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(n, a, b) = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)
n_max = l.count(max(l))
ans = 0
if n_max > a:
	for i in range(a, min(b + 1, n_max + 1)):
		ans += combi(n_max, i)
	print(max(l))
	print(ans)
	exit()
n_min = l.count(l[a - 1])
i_min = l.index(l[a - 1])
k = a - i_min
ans += combi(n_min, k)
print(sum(l[:a]) / a)
print(ans)


from math import factorial
(n, a, b) = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
n1 = v.count(v[a - 1])
n2 = v[:a].count(v[:a][a - 1])
print(sum(v[:a]) / a)
if len(set(v[:a])) != 1:
	if n1 == n2:
		print(1)
	else:
		print(int(factorial(n1) / (factorial(n2) * factorial(n1 - n2))))
else:
	ans = 0
	if n1 == 1:
		print(1)
	else:
		for i in range(a, min(n1 + 1, b + 1)):
			ans += int(factorial(n1) / (factorial(i) * factorial(n1 - i)))
		print(int(ans))


(N, A, B) = map(int, input().split())
V = sorted([int(i) for i in input().split()], reverse=True)
VA = V[:A]
print(sum(VA) / A)
last = VA[-1]
x = VA.count(last)
y = V.count(last)

def comb(n, k):
	k = min(k, n - k)
	result = 1
	for i in range(n, n - k, -1):
		result *= i
	for i in range(1, k + 1):
		result //= i
	return result
if V.count(V[0]) > A:
	ans = 0
	u = min(V.count(V[0]), B)
	for i in range(A, u + 1):
		ans += comb(y, i)
else:
	ans = comb(y, x)
print(ans)


from operator import mul
from functools import reduce

def cmb(n, r):
	r = min(n - r, r)
	if r == 0:
		return 1
	over = reduce(mul, range(n, n - r, -1))
	under = reduce(mul, range(1, r + 1))
	return over // under
(N, A, B) = map(int, input().split())
V = list(map(int, input().split()))
V.sort()
av_max = 0
count = 0
for i in range(A, B + 1):
	if sum(V[N - i:N]) / i > av_max:
		av_max = sum(V[N - i:N]) / i
		count = cmb(V.count(V[N - i]), V[N - i:N].count(V[N - i]))
	elif sum(V[N - i:N]) / i == av_max:
		count += cmb(V.count(V[N - i]), V[N - i:N].count(V[N - i]))
print(av_max)
print(count)