Jeff got 2n real numbers a1, a2, ..., a2n as a birthday present. The boy hates non-integer numbers, so he decided to slightly "adjust" the numbers he's got. Namely, Jeff consecutively executes n operations, each of them goes as follows:

  * choose indexes i and j (i ≠ j) that haven't been chosen yet; 
  * round element ai to the nearest integer that isn't more than ai (assign to ai: ⌊ ai ⌋); 
  * round element aj to the nearest integer that isn't less than aj (assign to aj: ⌈ aj ⌉). 



Nevertheless, Jeff doesn't want to hurt the feelings of the person who gave him the sequence. That's why the boy wants to perform the operations so as to make the absolute value of the difference between the sum of elements before performing the operations and the sum of elements after performing the operations as small as possible. Help Jeff find the minimum absolute value of the difference.

Input

The first line contains integer n (1 ≤ n ≤ 2000). The next line contains 2n real numbers a1, a2, ..., a2n (0 ≤ ai ≤ 10000), given with exactly three digits after the decimal point. The numbers are separated by spaces.

Output

In a single line print a single real number — the required difference with exactly three digits after the decimal point.

Examples

Input

3
0.000 0.500 0.750 1.000 2.000 3.000


Output

0.250


Input

3
4469.000 6526.000 4864.000 9356.383 7490.000 995.896


Output

0.279

Note

In the first test case you need to perform the operations as follows: (i = 1, j = 4), (i = 2, j = 3), (i = 5, j = 6). In this case, the difference will equal |(0 + 0.5 + 0.75 + 1 + 2 + 3) - (0 + 0 + 1 + 1 + 2 + 3)| = 0.25.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Mathematics

Dynamic programming

Implementation

Greedy algorithms


Solutions:
n = int(input())
As = list(map(float, input().split()))
B = list((x - int(x) for x in As if x - int(x) > 0.0))
l = len(B)
if l == 0:
	print('{:.3f}'.format(0))
	exit(0)
S = sum((x for x in B))
ll = l if l % 2 == 0 else l + 1
ans = 10000000000.0
for i in range(max(0, l - n), (n if l > n else l) + 1):
	ans = min(ans, abs(i - S))
print('{:.3f}'.format(ans))


k = 0
ans = 0
n = int(input())
a = input().split()
for i in range(2 * n):
	s = float(a[i])
	if s != int(s):
		k += 1
		ans += int(s) + 1 - s
if ans - int(ans) > 0.5:
	p = int(ans) + 1
else:
	p = int(ans)
if p > n:
	p = n
if p + n >= k:
	print('%.3f' % abs(ans - p))
else:
	print('%.3f' % abs(ans - k + n))


n = int(input())
l = list(map(float, input().split()))
l = sorted([x - int(x) for x in l if x - int(x) != 0])
o = 2 * n - len(l)
su = sum(l)
ans = 1152921504606846975
for i in range(n + 1):
	if i + o >= n:
		ans = min(ans, abs(i - su))
print('%.3f' % ans)


from sys import *
s1 = stdin.readline().strip()
n = int(s1)
s1 = stdin.readline().strip()
a = list(map(float, s1.split()))
b = []
for i in range(2 * n):
	if int(a[i]) != a[i]:
		b.append(round(1000 * (a[i] - int(a[i]))))
m = len(b)
r = 0
for i in range(m):
	r = r + b[i]
if m <= n:
	if r >= 1000 * m:
		r = r - 1000 * m
	else:
		r = min(r - 1000 * (r // 1000), 1000 - r + 1000 * (r // 1000))
elif r >= n * 1000:
	r = r - 1000 * n
elif r <= 1000 * (m - n):
	r = 1000 * (m - n) - r
else:
	r = min(r - 1000 * (r // 1000), 1000 - r + 1000 * (r // 1000))
r = r / 1000
print('%.3f' % r)


from sys import *
import math

def numline(f=int):
	return map(f, input().split())
n = int(input())
a = list(filter(lambda x: x != 0, numline(lambda s: int(s.split('.')[1]))))
c0 = min(2 * n - len(a), len(a))
s = sum(a) - 1000 * min(n, len(a))
ans = abs(s)
for i in range(c0):
	s += 1000
	ans = min(ans, abs(s))
print('{}.{:0>3}'.format(ans // 1000, ans % 1000))


n = int(input())
arr = list(map(float, input().split()))
arr = sorted([x - int(x) for x in arr if x - int(x) != 0])
o = 2 * n - len(arr)
arr_sum = sum(arr)
res = int(2000000000.0)
for i in range(n + 1):
	if i + o >= n:
		res = min(res, abs(i - arr_sum))
print('%.3f' % res)


N = int(input())
n = N
A = list(map(float, input().strip().split(' ')))
z = 0
for i in range(len(A)):
	A[i] = round(A[i], 3) - int(A[i])
	if A[i] == 0:
		z += 1
ANS = sum(A)
ans = 10 ** 10
for j in range(n - z, n + 1):
	ans = min(ans, abs(ANS - j))
print('%.3f' % ans)


n = int(input())
a = map(float, input().split())
s = 0
m = 0
for val in a:
	s += val - int(val)
	m += val - int(val) > 0
v = 1000000000.0
for i in range(max(0, m - n), min(n, m) + 1):
	v = min(v, abs(s - i))
print('%.3f' % v)


import math
n = int(input())
nums = input().split()
float_nums = [float(ele) for ele in nums]
diff = 0.0
count = 0
for x in float_nums:
	diff += x - math.floor(x)
	if math.ceil(x) > math.floor(x):
		count += 1
min_num = max(0, count - n)
max_num = min(count, n)
if math.ceil(diff) - diff <= 0.5:
	t = math.ceil(diff)
else:
	t = math.floor(diff)
if t < min_num:
	print('{0:.3f}'.format(min_num - diff))
elif t > max_num:
	print('{0:.3f}'.format(diff - max_num))
else:
	print('{0:.3f}'.format(math.fabs(diff - t)))


(n, t) = (int(input()), [int(i[-3:]) for i in input().split()])
(k, s) = (t.count(0), sum(t))
c = s // 1000 + int(s % 1000 > 500)
(a, b) = (max(0, n - k), min(2 * n - k, n))
if a <= c <= b:
	s = abs(c * 1000 - s)
else:
	s = min(abs(a * 1000 - s), abs(b * 1000 - s))
print(str(s // 1000) + '.' + str(s % 1000).zfill(3))


(n, k, s) = (int(input()), 0, 0)
for i in input().split():
	j = int(i[-3:])
	if j == 0:
		k += 1
	else:
		s += j
c = s // 1000 + int(s % 1000 > 500)
(a, b) = (max(0, n - k), min(2 * n - k, n))
if a <= c <= b:
	s = abs(c * 1000 - s)
else:
	s = min(abs(a * 1000 - s), abs(b * 1000 - s))
print(str(s // 1000) + '.' + str(s % 1000).zfill(3))


n = int(input())
a = list(map(lambda x: int(x.split('.')[1]), input().split()))
s = sum(a) - n * 1000
zero_cnt = a.count(0)
min_add = max(0, zero_cnt - n)
max_add = min(n, zero_cnt)
answ = min((abs(s + i * 1000) for i in range(min_add, max_add + 1)))
print('{:d}.{:0>3d}'.format(answ // 1000, answ % 1000))


from math import ceil, floor
N = int(input())
Nums = list(map(float, input().split()))
Zeros = 0
Sum = 0.0
for Num in Nums:
	if Num - floor(Num) == 0:
		Zeros += 1
	else:
		Sum += Num - floor(Num)
Best = float(10 ** 9)
for i in range(Zeros + 1):
	Best = min(Best, abs(N - Zeros + i - Sum))
Best = str(float(round(Best, 3)))
Index = Best.find('.')
print(Best + '0' * (4 - (len(Best) - Index)))