Vus the Cossack has $n$ real numbers $a_i$. It is known that the sum of all numbers is equal to $0$. He wants to choose a sequence $b$ the size of which is $n$ such that the sum of all numbers is $0$ and each $b_i$ is either $\lfloor a_i \rfloor$ or $\lceil a_i \rceil$. In other words, $b_i$ equals $a_i$ rounded up or down. It is not necessary to round to the nearest integer.

For example, if $a = [4.58413, 1.22491, -2.10517, -3.70387]$, then $b$ can be equal, for example, to $[4, 2, -2, -4]$. 

Note that if $a_i$ is an integer, then there is no difference between $\lfloor a_i \rfloor$ and $\lceil a_i \rceil$, $b_i$ will always be equal to $a_i$.

Help Vus the Cossack find such sequence!


-----Input-----

The first line contains one integer $n$ ($1 \leq n \leq 10^5$) — the number of numbers.

Each of the next $n$ lines contains one real number $a_i$ ($|a_i| < 10^5$). It is guaranteed that each $a_i$ has exactly $5$ digits after the decimal point. It is guaranteed that the sum of all the numbers is equal to $0$.


-----Output-----

In each of the next $n$ lines, print one integer $b_i$. For each $i$, $|a_i-b_i|<1$ must be met.

If there are multiple answers, print any.


-----Examples-----
Input
4
4.58413
1.22491
-2.10517
-3.70387

Output
4
2
-2
-4

Input
5
-6.32509
3.30066
-0.93878
2.00000
1.96321

Output
-6
3
-1
2
2



-----Note-----

The first example is explained in the legend.

In the second example, we can round the first and fifth numbers up, and the second and third numbers down. We can round the fourth number neither up, nor down.

Difficulty: MEDIUM
Tags: Greedy algorithms

Mathematics

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
from math import floor, ceil
from sys import stdin
from os import write
n = int(stdin.readline())
aas = list(map(float, list(stdin)))
bbs = list(map(floor, aas))
s = sum(bbs)
for i in range(n):
	if s == 0:
		break
	if ceil(aas[i]) != bbs[i]:
		bbs[i] += 1
		s += 1
print('\n'.join(map(str, bbs)))


import math
t = int(input())
arr = []
for _ in range(t):
	arr.append(float(input()))
vis = [0] * t
for i in range(t):
	if arr[i] == math.floor(arr[i]):
		vis[i] = 1
arr = [math.floor(i) for i in arr]
x = sum(arr)
if x < 0:
	for i in range(t):
		if vis[i] == 0 and x < 0:
			arr[i] += 1
			x += 1
for i in range(t):
	print(arr[i])


import os, sys
from io import IOBase, BytesIO
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'
import math

def solution():
	n = int(input())
	s = 0
	ans = [0] * n
	l = []
	for i in range(n):
		f = float(input())
		s += math.floor(f)
		ans[i] = math.floor(f)
		l.append(f)
	for i in range(n):
		if s == 0:
			break
		if l[i] - math.floor(l[i]) == 0:
			continue
		ans[i] += 1
		if s > 0:
			s -= 1
		else:
			s += 1
	for i in range(n):
		print(ans[i])
t = 1
for _ in range(t):
	solution()


from math import floor
n = int(input())
a = []
b = []
is_int = []
for i in range(n):
	a.append(float(input()))
	b.append(floor(a[-1]))
	is_int.append(a[-1] == int(a[-1]))
d = -sum(b)
c = 0
for i in range(len(b)):
	if c == d:
		break
	if not is_int[i]:
		b[i] += 1
		c += 1
for i in b:
	print(i)


import math
n = int(input())
arr = []
l = []
f = []
for i in range(n):
	x = float(input())
	arr.append(x)
	l.append(math.floor(x))
	f.append(x - math.floor(x))
res = round(sum(f))
for i in range(n):
	if arr[i] == l[i]:
		print(l[i])
	elif res > 0:
		print(l[i] + 1)
		res -= 1
	else:
		print(l[i])


import math
n = int(input())
arr = []
flag = [True]
ans = 0
for i in range(n):
	arr.append(float(input()))
	if arr[i] > 0:
		if arr[i] - math.floor(arr[i]) == 0:
			flag.insert(i, False)
			arr[i] = math.floor(arr[i])
		else:
			arr[i] = math.floor(arr[i])
			flag.insert(i, True)
		ans += arr[i]
	else:
		if arr[i] - math.floor(arr[i]) == 0:
			flag.insert(i, False)
			arr[i] = math.floor(arr[i])
		else:
			arr[i] = math.floor(arr[i])
			flag.insert(i, True)
		ans += arr[i]
i = 0
while ans != 0:
	if i < len(arr):
		if flag[i]:
			arr[i] += 1
			ans += 1
		i += 1
	else:
		break
for i in range(len(arr)):
	print(arr[i])


import sys
a = []
for _ in range(int(input())):
	a.append(float(sys.stdin.readline()))
total_sum = 0
b = []
for a_i in a:
	if a_i == int(a_i):
		total_sum += int(a_i)
	else:
		b.append(a_i)
for ind in range(len(b)):
	if b[ind] < 0:
		b[ind] = int(b[ind]) - 1
		total_sum += b[ind]
	elif b[ind] > 0:
		b[ind] = int(b[ind]) + 1
		total_sum += b[ind]
ind = 0
while total_sum > 0:
	if b[ind] > 0:
		b[ind] -= 1
		total_sum -= 1
	ind += 1
ind = 0
while total_sum < 0:
	if b[ind] < 0:
		b[ind] += 1
		total_sum += 1
	ind += 1
ind = 0
for a_i in a:
	if a_i == int(a_i):
		print(int(a_i))
	else:
		print(b[ind])
		ind += 1


import sys
import math
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
nums = RI()
(flts, cels) = ([], [])
ceil_sum = 0
for _ in range(nums):
	current = float(input())
	flts.append(current)
	cciel = math.ceil(current)
	cels.append(cciel)
	ceil_sum += cciel
sums = 0
for i in range(nums):
	if abs(flts[i] - cels[i]) > 0:
		cels[i] = math.floor(flts[i])
		sums += 1
		if sums == ceil_sum:
			break
for i in cels:
	print(i)


n = int(input())
s = [0.0] * n
b = [False] * n
su = 0
for i in range(n):
	f = float(input())
	k = int(f)
	if abs(f - k) <= 1e-06:
		b[i] = True
		s[i] = k
	elif f > 0:
		s[i] = k
	else:
		s[i] = k - 1
	su += s[i]
for i in range(n):
	if not b[i] and su < 0:
		s[i] += 1
		su += 1
	print(s[i])


n = int(input())
array = [float(input()) for i in range(n)]
array_floor = []
sum_floor = 0
for a in array:
	if int(a) == a:
		array_floor.append((int(a), 0))
	elif a < 0:
		array_floor.append((int(a), -1))
	else:
		array_floor.append((int(a), 1))
	sum_floor += int(a)
itr = iter(array_floor)
array_floor.append('stop')
while sum_floor != 0:
	x = next(itr)
	if x[1] == 1 and sum_floor < 0:
		print(x[0] + 1)
		sum_floor += 1
	elif x[1] == -1 and sum_floor > 0:
		print(x[0] - 1)
		sum_floor -= 1
	else:
		print(x[0])
x = next(itr)
while x != 'stop':
	print(x[0])
	x = next(itr)


n = int(input())
ar = []
a = [0 for i in range(0, n)]
for i in range(0, n):
	ar.append(input())
s = 0
for i in range(0, n):
	a[i] = float(ar[i]) // 1
	s = s + a[i]
i = 0
if s < 0:
	while s != 0:
		if float(ar[i]) != float(ar[i]) // 1:
			a[i] += 1
			s += 1
		i += 1
for i in range(0, n):
	a[i] = int(a[i])
	print(a[i])


import sys
input = sys.stdin.readline
import math
n = int(input())
integer = [0] * (n + 1)
(exact, up, down, summa) = ([], [], [], 0)
for i in range(n):
	a = float(input())
	if a == int(a):
		integer[i] = 1
	up.append(math.ceil(a))
(j, i) = (0, 0)
posi = sum(up)
while posi > i:
	if integer[j] != 1:
		up[j] -= 1
		i += 1
	j += 1
for j in up:
	sys.stdout.write(str(j) + '\n')


import math
a = int(input())
li = []
b = 0
for i in range(a):
	k = float(input())
	if k == int(k):
		b += 1
		li.append(int(k))
	else:
		k = math.floor(k)
		if k < 0:
			li.append(k - 1e-11)
		else:
			li.append(k + 1e-11)
ans = 0
for i in li:
	ans += int(i)
if ans == 0:
	print(*li)
else:
	for i in li:
		if ans < 0:
			if i == int(i):
				print(i)
			else:
				ans += 1
				print(int(i) + 1)
		else:
			print(int(i))


N = int(input())
A = [float(input()) for _ in range(N)]
ans = [None] * N
can = []
for (i, a) in enumerate(A):
	if a >= 0 or float(int(a)) == a:
		ans[i] = int(a)
	else:
		ans[i] = int(a) - 1
	if float(int(a)) != a:
		can.append(i)
delta = -sum(ans)
for j in range(delta):
	ans[can[j]] += 1
for a in ans:
	print(a)


numbers = []
d = []
s = 0
for i in range(int(input())):
	n = input()
	if n[len(n) - 5:] == '00000':
		num = int(n[:len(n) - 6])
		numbers.append(num)
		s += num
		d.append(0)
	elif n[0] == '-':
		num = int(n[:len(n) - 6]) - 1
		numbers.append(num)
		s += num
		d.append(-1)
	else:
		num = int(n[:len(n) - 6])
		numbers.append(num)
		s += num
		d.append(1)
if s == 0:
	for i in numbers:
		print(i)
else:
	for i in range(len(numbers)):
		if s < 0:
			if d[i] != 0:
				s += 1
				print(numbers[i] + 1)
			else:
				print(numbers[i])
		else:
			print(numbers[i])


import math
n = int(input())
l = [float(input()) for _ in range(n)]
rem = [0] * n
for i in range(n):
	rem[i] = math.floor(l[i])
s = sum(rem)
i = 0
while s:
	if int(l[i]) != l[i]:
		s += 1
		rem[i] += 1
	i += 1
print(*rem, sep='\n')


n = int(input())
a = [0] * n
b = [0] * n
s = 0
for i in range(n):
	x = input()
	(q, w) = map(int, x.split('.'))
	if w:
		if x[0] == '-':
			a[i] = q
			b[i] = q - 1
		else:
			a[i] = q + 1
			b[i] = q
	else:
		a[i] = q
		b[i] = q
	s += a[i]
if s:
	for i in range(n):
		s -= a[i]
		s += b[i]
		(a[i], b[i]) = (b[i], a[i])
		if not s:
			break
for i in range(n):
	a[i] = str(a[i])
print('\n'.join(a))


from math import *
n = int(input())
som = 0
ch = []
ch2 = []
for i in range(n):
	f = float(input())
	ch.append(floor(f))
	ch2.append(f)
	som += floor(f)
i = 0
while som != 0:
	if ceil(ch2[i]) != ch2[i]:
		som += 1
		ch[i] += 1
	i += 1
for i in range(n):
	print(ch[i])


import math
n = int(input())
a = []
for i in range(n):
	a.append(float(input()))
b = []
c = [0] * n
for i in range(n):
	buf = math.floor(a[i])
	b.append(buf)
	if a[i] - buf < 10 ** (-5):
		c[i] = 1
x = sum(b)
i = 0
while x < 0:
	if c[i] == 0:
		x += 1
		b[i] += 1
	i += 1
for i in range(n):
	print(b[i])


import math as m
n = int(input())
a = []
ans = []
rem = 0
for i in range(n):
	x = float(input())
	a.append(x)
	ans.append(m.floor(x))
	rem += m.floor(x)
if rem == 0:
	for i in range(n):
		print(ans[i])
else:
	i = 0
	while rem != 0 and i < n:
		if m.floor(a[i]) != m.floor(m.ceil(a[i])):
			ans[i] = m.ceil(a[i])
			rem += 1
		i += 1
	for i in range(n):
		print(ans[i])


from math import floor, ceil
from sys import stdin, stdout
n = int(stdin.readline())
lf = []
s = 0
ans = [None] * n
N = n
for i in range(N):
	x = float(stdin.readline())
	fx = floor(x)
	cx = ceil(x)
	s += fx
	if fx == cx:
		ans[i] = fx
		n -= 1
		continue
	lf.append([fx, i])
slf = sorted(lf)
x = n + s
for i in range(n):
	if i < x:
		ans[slf[i][1]] = slf[i][0]
	else:
		ans[slf[i][1]] = slf[i][0] + 1
for i in ans:
	stdout.write(str(i) + '\n')


import math
import sys
sys.setrecursionlimit(1000000)

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = self.next_line()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_line(self):
		return sys.stdin.readline().split()

	def next_ints(self):
		return [int(x) for x in sys.stdin.readline().split()]

	def next_int(self):
		return int(self.next())

	def solve(self):
		n = self.next_int()
		ss = [self.next() for _ in range(n)]
		x = [int(math.ceil(float(v))) for v in ss]
		s = sum(x)
		for (i, v) in enumerate(x):
			if s > 0 and (not ss[i].endswith('.00000')):
				print(v - 1)
				s -= 1
			else:
				print(v)
Main().solve()


n = int(input())
l = []
pi = []
ni = []
su = 0
ll = []
for i in range(n):
	v = float(input())
	su += int(v)
	ll.append(v)
	l.append(int(v))
	if v < 0:
		ni.append(i)
	elif v > 0:
		pi.append(i)
while su > 0:
	if len(ni) > 0:
		i = ni.pop()
		if ll[i] - l[i] != 0:
			l[i] -= 1
			su -= 1
while su < 0:
	if len(pi) > 0:
		i = pi.pop()
		if ll[i] - l[i] != 0:
			l[i] += 1
			su += 1
print(*l, sep='\n')


n = int(input())
k = []
chisla = []
summa = 0
for i in range(n):
	x = float(input())
	p = int(x)
	if x < 0 and p != x:
		k.append(-1)
	elif x > 0 and p != x:
		k.append(1)
	else:
		k.append(0)
	chisla.append(p)
	summa += p
i = 0
while summa != 0:
	if summa > 0 and k[i] == -1:
		summa -= 1
		chisla[i] -= 1
	if summa < 0 and k[i] == 1:
		summa += 1
		chisla[i] += 1
	i += 1
for elem in chisla:
	print(elem)


from math import floor
n = int(input())
s = [float(input()) for i in range(n)]
l = [*map(floor, s)]
sums = sum(l)
i = 0
while sums:
	if l[i] != s[i]:
		l[i] += 1
		sums += 1
	i += 1
print(*l, sep='\n')


import math
import sys
input = sys.stdin.readline
n = int(input())
A = [float(input()) for i in range(n)]
ANS = [int(a) for a in A]
PLUS = sum(ANS)
i = 0
while PLUS != 0:
	if PLUS > 0 and A[i] < ANS[i]:
		ANS[i] -= 1
		PLUS -= 1
	elif PLUS < 0 and A[i] > ANS[i]:
		ANS[i] += 1
		PLUS += 1
	i += 1
for a in ANS:
	sys.stdout.write(str(a) + '\n')


import math
n = int(input())
plus = 0
vals = []
for i in range(n):
	current = float(input())
	vals.append(current)
	if not current.is_integer():
		plus += 1
ceils = [math.ceil(c) for c in vals]
ceils_sum = sum(ceils)
i = 0
while ceils_sum != 0:
	current = vals[i]
	if not current.is_integer():
		ceils_sum -= 1
		ceils[i] -= 1
	i += 1
for c in ceils:
	print(c)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
pos = list()
neg = list()
nc = list()
s1 = 0
s2 = 0
s = set()
for i in range(n):
	n = float(input())
	if n >= 0:
		ch = 1
	else:
		ch = 0
	if n == int(n):
		s.add(i)
	n = int(n)
	if ch > 0:
		s1 += n
		if i in s:
			nc.append([i, n])
			continue
		pos.append([i, n])
	else:
		s2 += abs(n)
		if i in s:
			nc.append([i, n])
			continue
		neg.append([i, n])
if s1 > s2:
	c = s1 - s2
	for i in range(c):
		neg[i][1] -= 1
elif s2 > s1:
	c = s2 - s1
	for i in range(c):
		pos[i][1] += 1
res = pos + neg + nc
res.sort()
for i in res:
	print(i[1])


import math

def zero_sum_integers(zero_sum_floats):
	integers = [math.floor(number) for number in zero_sum_floats]
	difference = sum(integers)
	i = 0
	while difference < 0 and i < len(integers):
		if zero_sum_floats[i] > integers[i]:
			integers[i] += 1
			difference += 1
		i += 1
	return integers
n = int(input())
floats = [0] * n
for i in range(n):
	floats[i] = float(input())
integers = zero_sum_integers(floats)
for integer in integers:
	print(integer)


n = int(input())
l = []
p = []
summ = 0
ans = 0
for _ in range(n):
	x = input()
	p.append(x)
	x = int(float(x))
	ans += x
	l.append(x)
if ans == 0:
	for i in l:
		print(i)
elif ans > 0:
	for i in range(n):
		if l[i] < 0 and p[i][-5:] != '00000':
			l[i] = l[i] - 1
			ans = ans - 1
			if ans == 0:
				break
		if l[i] == 0 and p[i][-5:] != '00000':
			if float(p[i]) < 0:
				l[i] = l[i] - 1
				ans = ans - 1
				if ans == 0:
					break
	for j in l:
		print(j)
else:
	for i in range(n):
		if l[i] > 0 and p[i][-5:] != '00000':
			l[i] = l[i] + 1
			ans = ans + 1
			if ans == 0:
				break
		if l[i] == 0 and p[i][-5:] != '00000':
			if float(p[i]) > 0:
				l[i] = l[i] + 1
				ans = ans + 1
				if ans == 0:
					break
	for j in l:
		print(j)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(1):
		n = ri()
		z = []
		cb = {}
		nett = 0
		for i in range(n):
			a = float(input())
			b = float(math.floor(a))
			z.append(b)
			if a * 100000 != b * 100000:
				cb[i] = 1
			nett += int(b)
		for i in range(n):
			if i in cb:
				if nett < 0:
					z[i] += 1
					nett += 1
				else:
					z[i] -= 1
					nett -= 1
				if nett == 0:
					break
		for i in z:
			print(int(i))
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


a = []
l = []
for i in range(int(input())):
	b = float(input())
	if int(b) == b:
		a.append(int(b))
		l.append(0)
	elif b < 0:
		a.append(int(b))
		l.append(1)
	else:
		a.append(int(b) + 1)
		l.append(1)
ll = sum(a)
if ll == 0:
	for i in a:
		print(i)
elif ll > 0:
	for i in range(len(a)):
		if l[i] != 0:
			a[i] -= 1
			ll -= 1
		if ll == 0:
			break
	for i in a:
		print(i)


from math import floor, ceil
n = int(input())
arr = []
arr2 = []
for x in range(n):
	arr.append(float(input()))
for x in arr:
	arr2.append(floor(x))
total = sum(arr2)
if total < 0:
	x = 0
	y = 0
	while y < abs(total):
		if floor(arr[x]) != arr[x]:
			arr2[x] += 1
			y += 1
		x += 1
else:
	x = 0
	y = 0
	while y < abs(total):
		if floor(arr[x]) != arr[x]:
			arr2[x] -= 1
			y += 1
		x += 1
for x in arr2:
	print(x)


from math import floor, ceil
n = int(input())
r = []
q = []
s = 0
for i in range(n):
	p = float(input())
	q.append(p)
	if p < 0:
		x = floor(p)
		s += x
		r.append(x)
	else:
		x = ceil(p)
		s += x
		r.append(x)
for i in range(n):
	if s > 0 and r[i] > q[i]:
		print(r[i] - 1)
		s -= 1
	elif s < 0 and r[i] < q[i]:
		print(r[i] + 1)
		s += 1
	else:
		print(r[i])


import math
n = int(input())
a = []
f = []
total = 0
for i in range(n):
	t = float(input())
	a.append(t)
	total += math.floor(t)
	f.append(math.floor(t))
for i in range(n):
	if total != 0 and f[i] != a[i]:
		f[i] += 1
		total += 1
for i in range(n):
	print(f[i])


from sys import stdin, stdout
n = int(input())
negitives = []
positives = []
for i in range(2):
	negitives.append([])
	positives.append([])
sums = 0
answer = [0] * n
for i in range(n):
	x = [float(x) for x in input().split()][0]
	if x < 0:
		if abs(int(x) - x) >= 10 ** (-6):
			negitives[1].append((i, x))
			sums += int(x)
			answer[i] = int(x)
		else:
			negitives[0].append((i, x))
			sums += int(x)
			answer[i] = int(x)
	if x > 0:
		if abs(int(x) - x) >= 10 ** (-6):
			positives[1].append((i, x))
			sums += int(x)
			answer[i] = int(x)
		else:
			positives[0].append((i, x))
			sums += int(x)
			answer[i] = int(x)
if sums > 0:
	for i in range(sums):
		answer[negitives[1][i][0]] -= 1
elif sums < 0:
	for i in range(abs(sums)):
		answer[positives[1][i][0]] += 1
for i in range(n):
	print(answer[i])


from math import floor
from sys import stdin
n = int(stdin.readline())
(arr1, arr2, integers) = ([], [], [])
for i in range(n):
	arr1.append(float(stdin.readline()))
	arr2.append(floor(arr1[-1]))
	integers.append(arr1[-1] == int(arr1[-1]))
s = -sum(arr2)
c = 0
for i in range(len(arr2)):
	if s == c:
		break
	if not integers[i]:
		arr2[i] += 1
		c += 1
print(*arr2, sep='\n')


import math
from sys import stdin, stdout
input = stdin.readline
n = int(input())
a = []
b = []
s = 0
for _ in range(n):
	x = float(input())
	a.append(x)
	b.append(math.ceil(x))
	s += math.ceil(x)
if s > 0:
	for i in range(n):
		s -= b[i] - math.floor(a[i])
		b[i] = math.floor(a[i])
		if s == 0:
			break
for el in b:
	stdout.write(f'{el}\n')


from math import floor
n = int(input())
l = [float(input()) for i in range(n)]
l1 = [floor(i) for i in l]
s = sum(l1)
for i in range(len(l1)):
	add = 0
	if s < 0:
		add = 1
	if l[i] != l1[i]:
		print(l1[i] + add)
		s += 1
	else:
		print(l1[i])


import math
n = int(input())
b = []
c = []
for i in range(n):
	a = float(input())
	c.append(a)
	if abs(math.trunc(c[i]) - c[i]) < 1e-06:
		b.append(round(a))
		continue
	if a > 0:
		b.append(math.trunc(a))
	elif a < 0:
		b.append(math.trunc(a) - 1)
	else:
		b.append(0)
x = sum(b)
i = 0
while x < 0:
	if abs(math.trunc(c[i]) - c[i]) < 1e-06:
		i += 1
	else:
		b[i] += 1
		i += 1
		x += 1
for i in range(n):
	print(b[i])


from math import *
ls = []
d = dict()
for _ in range(int(input())):
	ls.append(float(input()))
for i in range(len(ls)):
	if floor(ls[i]) == ceil(ls[i]):
		d[i] = 1
	ls[i] = ceil(ls[i])
ans = sum(ls)
if ans == 0:
	for i in ls:
		print(i)
else:
	for i in range(len(ls)):
		if i not in d and ans > 0:
			ls[i] -= 1
			ans -= 1
	for i in ls:
		print(i)


import math
n = int(input())
f = [0] * n
ans = []
for i in range(n):
	x = float(input())
	if math.ceil(x) == math.floor(x):
		f[i] = 0
	else:
		f[i] = 1
	ans.append(math.ceil(x))
s = sum(ans)
for i in range(n):
	if s > 0 and f[i] == 1:
		ans[i] -= 1
		s -= 1
for i in range(n):
	print(ans[i])


n = int(input())
a = []
b = []
s = 0
for i in range(n):
	x = float(input())
	a.append(x)
	b.append(int(x))
	s += b[-1]
if s < 0:
	for i in range(n):
		if s < 0 and a[i] != b[i] and (b[i] >= 0):
			if abs(a[i] - (b[i] + 1)) < 1:
				print(b[i] + 1)
				s += 1
			else:
				print(b[i])
		else:
			print(b[i])
elif s > 0:
	for i in range(n):
		if s > 0 and a[i] != b[i] and (b[i] < 0):
			if abs(a[i] - (b[i] - 1)) < 1:
				print(b[i] - 1)
				s -= 1
			else:
				print(b[i])
		else:
			print(b[i])
else:
	for i in b:
		print(i)


import math
n = int(input())
L = []
ceil = 0
LL = []
for i in range(n):
	f = float(input())
	L.append(f)
	LL.append(math.ceil(f))
	ceil += math.ceil(f)
count = 0
for i in range(n):
	if abs(L[i] - LL[i]) > 0:
		LL[i] = math.floor(L[i])
		count += 1
		if count == ceil:
			break
for i in range(n):
	print(LL[i], end=' ')


import math
n = int(input())
a = []
for i in range(0, n):
	number = float(input())
	a.append(number)

def roundDown(number):
	result = math.floor(number)
	if math.isclose(result, number, abs_tol=1e-06):
		return (result, False)
	return (result, True)

def solve(a):
	result = [roundDown(x) for x in a]
	count = abs(sum([x[0] for x in result]))
	newResult = []
	for x in result:
		if x[1] and count > 0:
			newResult.append(x[0] + 1)
			count -= 1
			continue
		newResult.append(x[0])
	return newResult
[print(x) for x in solve(a)]


n = int(input())
a = []
b = []
for _ in range(n):
	s = input()
	(x, y) = map(int, s.split('.'))
	if s[0] == '-' and y:
		x -= 1
	a += (x,)
	b += (y,)
s = sum(a)
for i in range(n):
	if s < 0:
		if b[i]:
			a[i] += 1
			s += 1
	else:
		break
print('\n'.join(map(str, a)))


import math
n = int(input())
a = []
sm = 0
for i in range(n):
	q = float(input())
	sm += math.ceil(q)
	a.append(q)
for e in a:
	if int(e) != e:
		if sm:
			print(math.floor(e))
			sm -= 1
			continue
	print(math.ceil(e))


from math import *
n = int(input())
a = []
sm = 0
for i in range(n):
	x = float(input())
	a.append(x)
ans = []
for i in range(n):
	ans.append(floor(a[i]))
	sm += floor(a[i])
if sm == 0:
	for i in ans:
		print(i)
else:
	for i in range(n):
		if ceil(a[i]) != floor(a[i]):
			ans[i] += 1
			sm += 1
		if sm == 0:
			break
	for i in ans:
		print(i)


from sys import setcheckinterval, stdin, setrecursionlimit
setcheckinterval(1000)
setrecursionlimit(10 ** 7)

def iin():
	return int(stdin.readline())

def lin():
	return list(map(int, stdin.readline().split()))

def chek(a):
	if int(a * 100000) == int(a) * 100000:
		return True
	return False
from decimal import *
getcontext().prec = 8
n = iin()
a = [Decimal(input()) for i in range(n)]
ch = 0
aa = []
for i in a:
	ch += i - int(i)
	aa.append(int(i))
ch = int(ch)
for i in range(n):
	if ch > 0 and a[i] > 0 and (not chek(a[i])):
		aa[i] += 1
		ch -= 1
	elif ch < 0 and a[i] < 0 and (not chek(a[i])):
		aa[i] -= 1
		ch += 1
	elif ch == 0:
		break
print(*aa, sep='\n')


import math
a = []
b = []
n = int(input())
sum = 0
for i in range(n):
	x = float(input())
	a.append(math.floor(x))
	b.append(math.ceil(x))
	sum += a[i]
pos = 0
while sum < 0 and pos < n:
	if a[pos] == b[pos]:
		print(a[pos], end=' ')
	else:
		print(b[pos], end=' ')
		sum += 1
	pos += 1
for i in range(pos, n):
	print(a[i], end=' ')
print()


import math
n = int(input())
a = []
b = []
for i in range(n):
	a.append(float(input()))
	b.append(int(a[i]))
i = 0
q = sum(b)
while q != 0:
	if q > 0 and a[i] < b[i]:
		b[i] -= 1
		q -= 1
	elif q < 0 and a[i] > b[i]:
		b[i] += 1
		q += 1
	i += 1
for i in range(n):
	print(b[i])


from math import floor
n = int(input())
s = 0

class Pair:

	def __init__(self, a, b):
		self.a = a
		self.b = b
numbers = []
for i in range(n):
	a = input()
	b = floor(float(a))
	numbers.append(Pair(b, a[-5:] != '00000'))
	s += b
i = 0
while s != 0:
	if numbers[i].b:
		numbers[i].a += 1
		s += 1
	i += 1
print(*(str(el.a) for el in numbers), sep='\n')


n = int(input())
ans = []
bad = [0] * n
curr = 0
for i in range(n):
	s = input()
	num = []
	for j in s:
		if j != '.':
			num.append(j)
	num = int(''.join(num))
	if num % 100000 == 0:
		bad[i] = 1
	curr += num % 100000
	ans.append(num // 100000)
r = curr // 100000
count = 0
i = 0
while count < r:
	if bad[i]:
		i += 1
		continue
	ans[i] += 1
	i += 1
	count += 1
print(' '.join(map(str, ans)))


n = int(input())

def f(x):
	(u, v) = map(int, x.split('.'))
	if v:
		return (u - 1 if x[0] == '-' else u, 1)
	else:
		return (u, 0)
a = [f(input()) for _ in range(n)]
s = sum((x[0] for x in a))
for (u, v) in a:
	if s < 0:
		print(u + v)
		s += v
	else:
		print(u)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import collections as col
import math

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	N = getInt()
	curr = 0
	for n in range(N):
		x = float(getStr())
		if curr >= 0:
			y = math.ceil(x)
			curr += x - y
			print(int(y))
		else:
			y = math.floor(x)
			curr += x - y
			print(int(y))
	return
solve()


inte = 0
pos_fl = 0
neg_fl = 0
arr = []
sgn = []
for i in range(int(input())):
	inp = input()
	flt = float(inp)
	if flt == int(flt):
		inte += int(flt)
		sgn.append('*')
	elif flt > 0:
		pos_fl += int(flt)
		sgn.append('+')
	else:
		neg_fl += int(flt)
		sgn.append('-')
	arr.append(int(flt))
if inte + pos_fl + neg_fl == 0:
	for i in arr:
		print(i)
else:
	if inte + pos_fl + neg_fl > 0:
		diff = inte + pos_fl + neg_fl
		ptr = 0
		while diff > 0:
			if sgn[ptr] == '-':
				arr[ptr] -= 1
				diff -= 1
			ptr += 1
	else:
		diff = inte + pos_fl + neg_fl
		ptr = 0
		while diff < 0:
			if sgn[ptr] == '+':
				arr[ptr] += 1
				diff += 1
			ptr += 1
	for i in arr:
		print(i)


import sys
from math import *
n = int(input())
org = [0] * n
sum_f = 0
for i in range(n):
	num = float(sys.stdin.readline().rstrip())
	org[i] = num
	sum_f += floor(num)
i = 0
while sum_f < 0 and i < n:
	if floor(org[i]) < ceil(org[i]):
		sum_f += 1
		org[i] = ceil(org[i])
	else:
		org[i] = floor(org[i])
	i += 1
if i > n:
	print(-1)
	exit()
	i += 1
for i in org:
	print(floor(i))


from math import floor
a = int(input())
m = []
m1 = []
r = 0
for i in range(a):
	h = float(input())
	m.append(floor(h))
	m1.append(-floor(-h))
	r += m[-1]
i = 0
if r != 0:
	while r != 0:
		r -= m[i]
		m[i] = m1[i]
		r += m[i]
		i += 1
for i in m:
	print(i)


import io, os, math
input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline
n = int(input())
a = [float(input()) for _ in range(n)]
ans = [None] * n
sm = 0
idx = []
for i in range(n):
	if a[i] == int(a[i]):
		ans[i] = int(a[i])
		sm += ans[i]
	else:
		idx.append(i)
pos = [i for i in idx if a[i] > 0]
neg = [i for i in idx if a[i] < 0]
d = sum((int(a[i]) for i in idx))
while pos and sm + d < 0:
	i = pos.pop()
	ans[i] = int(a[i] + 1)
	sm += ans[i]
	d -= int(a[i])
while neg and sm + d > 0:
	i = neg.pop()
	ans[i] = int(a[i] - 1)
	sm += ans[i]
	d -= int(a[i])
for i in pos:
	ans[i] = int(a[i])
for i in neg:
	ans[i] = int(a[i])
assert sum(ans) == 0
print(*ans, sep='\n')


n = int(input())
a = []
for i in range(n):
	a.append(input())
b = []
r = []
for i in range(n):
	t = a[i]
	index = t.find('.')
	if t[0] == '-':
		b.append(int(t[:index]))
		r.append(int(t[index + 1:]))
	else:
		tr = int(t[index + 1:])
		if tr == 0:
			r.append(0)
			b.append(int(t[:index]))
		else:
			r.append(100000 - tr)
			b.append(int(t[:index]) + 1)
s = sum(r)
s /= 100000
for i in range(n):
	if s == 0:
		break
	if r[i] != 0:
		b[i] -= 1
		s -= 1
for num in b:
	print(num)


n = int(input())
a = []
temp = 0
flag = [0] * n
for i in range(n):
	x = float(input())
	if int(x) == x:
		flag[i] = 1
	a.append(x)
for i in range(len(a)):
	if flag[i] == 1:
		temp += int(a[i])
		a[i] = int(a[i])
		continue
	if a[i] < 0:
		temp += int(a[i]) - 1
		a[i] = int(a[i]) - 1
	else:
		temp += int(a[i])
		a[i] = int(a[i])
ans = []
for i in range(n):
	if flag[i] == 1:
		ans.append(a[i])
		continue
	if temp < 0:
		ans.append(a[i] + 1)
		temp += 1
	else:
		ans.append(a[i])
for i in ans:
	print(int(i))


n = int(input())
nums = []
neg = 0
pos = 0
negTot = 0
posTot = 0
negInt = 0
posInt = 0
for _ in range(n):
	temp = float(input())
	nums.append(temp)
	if temp > 0:
		pos += 1
		posTot += int(temp)
		if temp % 1 == 0:
			posInt += 1
	else:
		neg += 1
		negTot += int(temp)
		if temp % 1 == 0:
			negInt += 1
diff = posTot + negTot
if diff == 0:
	for i in nums:
		print(int(i))
elif diff > 0:
	for i in nums:
		if i < 0 and i % 1 != 0:
			if diff > 0:
				print(int(i) - 1)
				diff -= 1
			else:
				print(int(i))
		else:
			print(int(i))
else:
	for i in nums:
		if i > 0 and i % 1 != 0:
			if diff < 0:
				print(int(i) + 1)
				diff += 1
			else:
				print(int(i))
		else:
			print(int(i))


n = int(input())
a = [input() for _ in range(n)]
ans = []
ch = [False] * n
cur = -1
for i in a:
	cur += 1
	if '.' in i:
		curi = i.split('.')
		if curi[1].count('0') == len(curi[1]):
			ans.append(int(curi[0]))
			continue
		ch[cur] = True
		if curi[0][0] == '-':
			ans.append(int(curi[0]) - 1)
		else:
			ans.append(int(curi[0]))
	else:
		ans.append(int(i))
curs = sum(ans)
for i in range(n):
	if curs < 0 and ch[i]:
		curs += 1
		ans[i] += 1
print(*ans, sep='\n')


import math
n = int(input())
lol = []
for i in range(n):
	lol.append(float(input()))
s = 0
for i in lol:
	s -= math.floor(i)
for i in lol:
	if math.floor(i) != i:
		if s > 0:
			print(math.ceil(i))
			s -= 1
		else:
			print(math.floor(i))
	else:
		print(math.floor(i))


import sys
import math
from collections import defaultdict
n = int(sys.stdin.readline())
integer = [False for _ in range(n)]
(arr1, arr2) = ([], [])
for _ in range(n):
	a = float(sys.stdin.readline()[:-1])
	if a % 1 == 0:
		arr1.append(a)
		arr2.append(a)
		integer[_] = True
	else:
		(c, d) = (math.floor(a), math.ceil(a))
		if a < 0:
			arr1.append(d)
			arr2.append(c)
		else:
			arr1.append(d)
			arr2.append(c)
s = sum(arr1)
i = 0
ans = []
while s > 0:
	if integer[i] == False:
		ans.append(arr2[i])
		s -= 1
		i += 1
	else:
		ans.append(arr1[i])
		i += 1
for j in range(i, n):
	ans.append(arr1[j])
for i in range(n):
	print(int(ans[i]))


import math
t = 0
num = []
for _ in range(0, int(input())):
	n = float(input())
	num.append(n)
	t += int(n)
if t == 0:
	for i in range(0, len(num)):
		if num[i] > 0:
			num[i] = math.floor(num[i])
		else:
			num[i] = math.ceil(num[i])
elif t < 0:
	c = -1 * t
	for i in range(0, len(num)):
		if num[i] > 0 and c > 0 and (num[i] != int(num[i])):
			num[i] = math.ceil(num[i])
			c -= 1
		num[i] = int(num[i])
else:
	c = t
	for i in range(0, len(num)):
		if num[i] < 0 and c > 0 and (num[i] != int(num[i])):
			num[i] = math.floor(num[i])
			c -= 1
		num[i] = int(num[i])
for i in range(0, len(num)):
	print(num[i])


n = int(input())
a = []
d = 0
p = []
q = []
for i in range(n):
	s = float(input())
	if s < 0 and s % 1 != 0:
		k = int(s // 1) + 1
		a.append(k)
		d += k
		p.append(i)
	elif s > 0 and s % 1 != 0:
		k = int(s // 1)
		a.append(k)
		d += k
		q.append(i)
	else:
		k = int(s // 1)
		a.append(k)
		d += k
if d > 0:
	i = 0
	while d > 0:
		a[p[i]] -= 1
		i += 1
		d -= 1
elif d < 0:
	i = 0
	while d < 0:
		a[q[i]] += 1
		d += 1
		i += 1
print(*a, sep='\n')


n = int(input())
l = []
inv = 0
ind = []
for i in range(n):
	nu = float(input())
	if int(nu) == nu:
		inv += 1
		ind.append(i)
		l.append(int(nu))
	elif nu >= 0:
		l.append(int(nu) + 1)
	else:
		l.append(int(nu))
s = sum(l)
if s == 0:
	print(*l)
else:
	cnt = 0
	i = 0
	j = 0
	while j < inv and ind[j] == i:
		i += 1
		j += 1
	while i < n - 1 and cnt < s:
		l[i] -= 1
		i += 1
		cnt += 1
		while j < inv and i == ind[j]:
			i += 1
			j += 1
	print(*l)


n = int(input())
a = []
b = [0] * n
ans = 0
for i in range(n):
	q = float(input())
	if q != int(q):
		if q > 0:
			b[i] = 1
		elif q < 0:
			b[i] = -1
	ans += int(q)
	a.append(int(q))
if ans != 0:
	if ans > 0:
		i = 0
		while ans != 0 and i < n:
			if b[i] == -1:
				a[i] -= 1
				ans -= 1
			i += 1
	else:
		i = 0
		while ans != 0 and i < n:
			if b[i] == 1:
				a[i] += 1
				ans += 1
			i += 1
for i in range(n):
	print(a[i])


n = int(input())
arr = []
p = 0
for i in range(n):
	t = float(input())
	arr.append(t)
	p += t - int(t)
j = round(p)
for i in range(n):
	if j and arr[i] != int(arr[i]):
		if arr[i] * j > 0:
			if j > 0:
				print(int(arr[i]) + 1)
				j -= 1
			else:
				print(int(arr[i]) - 1)
				j += 1
		else:
			print(int(arr[i]))
	else:
		print(int(arr[i]))


from math import ceil, floor
n = int(input())
(nos, res) = ([], [])
for i in range(n):
	nos.append(float(input()))
for i in nos:
	res.append(floor(i))
s = sum(res)
if s == 0:
	print(*res, sep='\n')
else:
	for i in range(n):
		if s == 0:
			break
		if nos[i] != res[i]:
			res[i] += 1
			s += 1
	print(*res, sep='\n')


n = int(input())
a = []
b = []
for i in range(0, n):
	a.append(float(input()))
for i in range(0, n):
	b.append(int(a[i]))
	if a[i] > 0 and a[i] % 1 != 0:
		b[i] += 1
s = sum(b)
if s > 0:
	i = 0
	while s > 0 and i < n:
		if a[i] % 1 != 0:
			b[i] -= 1
			s -= 1
		i += 1
elif s < 0:
	i = 0
	while s < 0 and i < n:
		if a[i] % 1 != 0:
			b[i] -= 1
			s -= 1
		i += 1
for i in b:
	print(i)


import sys
n = int(input())
a = []
sm = 0
b = []
for i in range(n):
	a.append(float(sys.stdin.readline()))
	b.append(int(a[-1]))
	sm += b[-1]
if sm != 0:
	inc = sm if sm < 0 else 0
	dec = -sm if sm > 0 else 0
	for i in range(n):
		if abs(a[i] - b[i]) > 1e-06:
			if sm < 0 and a[i] > 0:
				b[i] += 1
				sm += 1
			elif sm > 0 and a[i] < 0:
				b[i] -= 1
				sm -= 1
		if sm == 0:
			break
for i in range(n):
	sys.stdout.write(f'{b[i]}\n')


import math
import sys
input = sys.stdin.readline
n = int(input())
bal = 0
for i in range(n):
	x = float(input())
	if x == int(x):
		print(int(x))
	elif bal > 0:
		if x > 0:
			print(int(x))
			bal -= x - int(x)
		else:
			print(-math.ceil(abs(x)))
			bal -= math.ceil(abs(x)) + x
	elif bal <= 0:
		print(math.ceil(x))
		bal += math.ceil(x) - x


inputs = int(input())
numbers = []
a = []
sign = []
sum = 0
for i in range(inputs):
	x = float(input())
	numbers.append(x)
	if x % 1 == 0:
		a.append(1)
	else:
		a.append(0)
	if x >= 0:
		sign.append(1)
	else:
		sign.append(0)
	numbers[i] = int(numbers[i])
	sum += numbers[i]
count = 0
if sum <= 0:
	for l in range(abs(0 - sum)):
		while a[count + l] == 1 or sign[count + l] == 0:
			count += 1
		numbers[count + l] += 1
else:
	for l in range(abs(0 - sum)):
		while a[count + l] == 1 or sign[count + l] == 1:
			count += 1
		numbers[count + l] -= 1
print(*numbers, sep='\n')


from math import *
n = int(input())
arr = []
sum1 = 0
sum2 = 0
mark = []
for i in range(n):
	s = str(input())
	if s[0] == '-':
		val1 = -int(s[1:-6])
	else:
		val1 = int(s[:-6])
	sum1 += val1
	if s[-5:].count('0') == 5:
		mark.append(1)
	elif s[0] == '-':
		mark.append(2)
	else:
		mark.append(3)
	arr.append(val1)
if sum1 == 0:
	print(*arr)
else:
	diff = sum1
	finalarr = []
	for i in range(n):
		if mark[i] != 1:
			if diff > 0 and mark[i] == 2:
				arr[i] -= 1
				diff -= 1
			elif diff < 0 and mark[i] == 3:
				arr[i] += 1
				diff += 1
	print(*arr)


n = int(input())
a = []
m = []
for i in range(n):
	x = float(input())
	y = [int(x), x - int(x)]
	if x < 0 and y[1] != 0:
		y[0] -= 1
	a.append(y)
sum = 0
for i in range(n):
	sum += a[i][0]
for i in range(n):
	if sum < 0 and a[i][1] != 0:
		a[i][0] += 1
		sum += 1
for i in range(n):
	print(a[i][0])


from math import ceil
n = int(input())
l = []
seti = set()
for i in range(n):
	z = float(input())
	if int(z) == z:
		seti.add(i)
	l.append(ceil(z))
z1 = sum(l)
if z1 == 0:
	print(*l)
else:
	if z1 > 0:
		for i in range(n):
			if i not in seti and z1 > 0:
				if l[i] != 0:
					l[i] -= 1
					z1 -= 1
	else:
		for i in range(n):
			if i not in seti and z1 < 0:
				if l[i] < 0:
					l[i] += 1
					z1 += 1
	print(*l)


n = int(input())
li = []
dp = []
s = 0
for i in range(n):
	x = float(input())
	li.append(int(x))
	s += int(x)
	dp.append(x)
if s > 0:
	for i in range(n):
		if li[i] < 0 and li[i] != dp[i]:
			li[i] -= 1
			s -= 1
		elif li[i] == 0 and dp[i] < 0:
			li[i] -= 1
			s -= 1
		if s == 0:
			break
elif s < 0:
	for i in range(n):
		if li[i] > 0 and li[i] != dp[i]:
			li[i] += 1
			s += 1
		elif li[i] == 0 and dp[i] > 0:
			li[i] += 1
			s += 1
		if s == 0:
			break
for i in range(n):
	print(li[i])


n = int(input())
zero = [False] * n
num = []
for i in range(n):
	f = float(input())
	c = int(f)
	if c == f:
		zero[i] = True
		num.append(c)
	else:
		num.append(c - 1 if f < 0 else c)
add = -sum(num)
for i in range(n):
	if add > 0 and zero[i] is False:
		add -= 1
		print(num[i] + 1)
	else:
		print(num[i])


n = int(input())
dig = []
dec = 0
z = 0
for _ in range(n):
	x = float(input())
	dec += round(x - int(x), 5)
	dig.append([int(x), round(x - int(x), 5)])
c = round(dec)
f = -1 if c > 0 else 1
for i in range(n):
	if c * (dig[i][0] + dig[i][1]) > 0 and c != 0 and (dig[i][1] != 0):
		dig[i][0] += -f
		c += f
print(*[dig[i][0] for i in range(n)])


n = int(input())
(v, a) = ([0] * n, [0] * n)
for i in range(n):
	v[i] = float(input())
	if abs(v[i]) - int(abs(v[i])) > 0.0:
		a[i] = 1
		if v[i] >= 0.0:
			v[i] = int(v[i])
		else:
			v[i] = int(v[i]) - 1
	else:
		v[i] = int(v[i])
s = sum(v)
i = 0
while i < n and s < 0:
	if a[i]:
		v[i] += 1
		s += 1
	i += 1
for i in range(n):
	print(v[i])


n = int(input())
i = 0
b = []
c = []
res = 0
while i < n:
	s = input()
	z = s.find('.')
	if z == -1 or s[z:z + 6] == '.00000':
		r = float(s)
		r = int(r)
		c.append(0)
	else:
		r = int(s[0:z])
		if s[0:1] == '-':
			c.append(-1)
		else:
			c.append(1)
	b.append(r)
	res = res + r
	i = i + 1
i = 0
while res > 0:
	while c[i] != -1:
		i = i + 1
	b[i] = b[i] - 1
	i = i + 1
	res = res - 1
i = 0
while res < 0:
	while c[i] != 1:
		i = i + 1
	b[i] = b[i] + 1
	i = i + 1
	res = res + 1
i = 0
while i < n:
	print(b[i])
	i = i + 1


n = int(input())
mark = [0 for i in range(int(100000.0) + 1)]
A = []
sum = 0
for i in range(n):
	a = float(input())
	if int(a) == a:
		mark[i] = 1
	if a < 0 and int(a) != a:
		a = -1 + a
	sum += int(a)
	A.append(int(a))
if sum != 0:
	k = -sum
	for i in range(n):
		if mark[i] == 0:
			A[i] += 1
			k -= 1
		if k <= 0:
			break
for i in range(n):
	print(A[i])


import math
n = input()
n = int(n)
arr = []
i = 0
tot = 0
while i < n:
	x = input()
	x = float(x)
	y = math.modf(x)
	if y[0] == 0:
		arr.append([y[1], 'n'])
	elif y[0] < 0:
		arr.append([y[1] - 1, 'y'])
	else:
		arr.append([y[1], 'y'])
	tot += arr[i][0]
	i = i + 1
i = 0
j = 0
tot *= -1
while i < n:
	if j < tot and arr[i][1] == 'y':
		arr[i][0] += 1
		j += 1
	print(int(arr[i][0]))
	i = i + 1


import math
n = int(input())
b = []
for i in range(n):
	a = float(input())
	b.append([math.floor(a), a])
counter = 0
for item in b:
	counter += item[0]
for i in range(n):
	if counter < 0:
		if b[i][0] != b[i][1]:
			b[i][0] += 1
			counter += 1
	else:
		break
for item in b:
	print(item[0])


from sys import stdin
from itertools import combinations
from math import ceil, fabs
input = stdin.readline
n = int(input())
a = [float(input()) for _ in range(n)]
l = len(a)
m = []
d = []
for i in range(l):
	if a[i] == int(a[i]):
		d.append(int(a[i]))
		m.append(1)
	else:
		m.append(0)
		if a[i] < 0:
			d.append(int(a[i] - 1))
		else:
			d.append(int(a[i]))
s = sum(d)
if s == 0:
	for i in d:
		print(i)
elif s < 0:
	for i in range(l):
		if m[i] == 0:
			d[i] += 1
			s += 1
			if s == 0:
				for i in d:
					print(i)
				break


import sys

class DVusTheCossackAndNumbers:

	def solve(self):
		import math
		n = int(input())
		d = []
		for _ in range(n):
			x = float(input())
			d.append([math.floor(x), math.ceil(x)])
		exc = 0
		chosen = [d[i][0] for i in range(n)]
		cur = sum(chosen)
		for i in range(n):
			if cur == 0:
				break
			chosen[i] = d[i][1]
			if d[i][1] != d[i][0]:
				cur += 1
		assert sum(chosen) == 0
		print('\n'.join((str(x) for x in chosen)))
solver = DVusTheCossackAndNumbers()
input = sys.stdin.readline
solver.solve()


from math import floor
n = int(input())
not_change = [False] * n
res = []
total = 0
for i in range(n):
	t = float(input())
	t_int = floor(t)
	if t == t_int:
		not_change[i] = True
	total += t_int
	res.append(t_int)
i = 0
while total < 0:
	if not_change[i]:
		i += 1
		continue
	res[i] += 1
	i += 1
	total += 1
for r in res:
	print(r)


n = int(input())
a = [0 for i in range(n)]
_sum = 0
for i in range(n):
	num = float(input())
	a[i] = num
	_sum += int(num)
i = 0
while _sum > 0 and i < n:
	if abs(a[i] - int(a[i])) > 1e-05 and a[i] < 0:
		a[i] -= 1
		_sum -= 1
	i += 1
i = 0
while _sum < 0 and i < n:
	if abs(a[i] - int(a[i])) > 1e-05 and a[i] > 0:
		a[i] += 1
		_sum += 1
	i += 1
for i in range(n):
	print(int(a[i]))


n = int(input())
a = []
summ = 0
for i in range(n):
	s = input()
	x = int(s[:-6])
	summ += x
	if s[-5:] == '00000':
		a.append([x, 0])
	else:
		if s[0] == '-':
			x -= 1
			summ -= 1
		a.append([x, 1])
i = 0
while i < n and summ != 0:
	if a[i][1]:
		a[i][0] += 1
		summ += 1
	i += 1
for i in range(n):
	print(a[i][0])


def main():
	from math import floor, ceil
	n = int(input())
	a = []
	b = []
	s = 0
	up = 0
	for i in range(n):
		a.append(float(input()))
		b.append(None)
		if not a[i] % 1:
			b[i] = int(a[i])
			s += int(a[i])
		elif a[i] > 0:
			up += 1
			s += ceil(a[i])
			b[i] = ceil(a[i])
		else:
			s += floor(a[i])
			b[i] = floor(a[i])
	if s == 0:
		for i in range(n):
			print(b[i])
	elif s > 0:
		cnt = abs(s)
		for i in range(n):
			if a[i] % 1 and a[i] > 0 and cnt:
				b[i] = floor(a[i])
				cnt -= 1
		for i in range(n):
			print(b[i])
	else:
		cnt = abs(s)
		for i in range(n):
			if a[i] % 1 and a[i] < 0 and cnt:
				b[i] = ceil(a[i])
				cnt -= 1
		for i in range(n):
			print(b[i])
main()


import sys
from math import floor, ceil
IS_LOCAL = False

def read_one(dtype=int):
	return dtype(input())

def read_multiple(f, dtype=int):
	return f(map(dtype, input().split()))

def main():
	n = 4
	a = [-2.6, 2.2, 1.1, -0.7]
	if not IS_LOCAL:
		n = read_one()
		a = []
		for i in range(n):
			a.append(read_one(float))
	b = [int(x) for x in a]
	ds = sum(b)
	for i in range(n):
		if abs(floor(a[i]) - ceil(a[i])) < 0.1 or ds == 0:
			continue
		x = int(ceil(a[i])) if ds < 0 else int(floor(a[i]))
		ds = ds - b[i] + x
		b[i] = x
	for i in range(n):
		print(b[i])
if len(sys.argv) > 1 and sys.argv[1] == 'True':
	IS_LOCAL = True
main()


import math
n = int(input())
num = []
for _ in range(n):
	num.append(float(input()))

def make_zero(nums):
	res = [math.floor(x) for x in nums]
	diff = sum(res)
	if diff == 0:
		return res
	new_nums = [x for x in res]
	if diff < 0:
		for i in range(len(res)):
			if diff == 0:
				break
			if res[i] != nums[i]:
				new_nums[i] = res[i] + 1
				diff += 1
	else:
		for i in range(len(res)):
			if diff == 0:
				break
			if res[i] != nums[i]:
				new_nums[i] = res[i] - 1
				diff -= 1
	return new_nums
res = make_zero(num)
for x in res:
	print(x)


import math
(n, t) = (int(input()), 0)
arr = [float(input()) for i in range(n)]
ans = [*map(math.floor, arr)]
for i in range(n):
	t += ans[i]
i = 0
while t != 0:
	if arr[i] != int(arr[i]):
		ans[i] += 1
		t += 1
	i += 1
for i in ans:
	print(i)


import math
n = int(input())
A = []
for _ in range(n):
	A.append(float(input()))
B = []
for i in range(n):
	B.append(math.floor(A[i]))
s = sum(B)
for i in range(n):
	if s != 0:
		if A[i] % 1 > 1e-07:
			B[i] += 1
			s += 1
	else:
		break
for el in B:
	print(el)


def main():
	import math
	from array import array
	n = int(input())
	A = array('l')
	is_int = array('h')
	summ = 0
	for i in range(n):
		x = float(input())
		if x.is_integer():
			is_int.append(True)
		else:
			is_int.append(False)
		A.append(math.floor(x))
		summ += A[i]
	for i in range(n):
		if summ < 0 and (not is_int[i]):
			A[i] += 1
			summ += 1
	for i in range(n):
		print(A[i])
main()


import math
n = int(input())
nums = []
bools = []
s = 0
for i in range(n):
	inp = float(input())
	dow = math.floor(inp)
	nums.append(dow)
	bools.append(inp != dow)
	s += dow
i = 0
while s != 0:
	if bools[i]:
		nums[i] += 1
		s += 1
	i += 1
for x in nums:
	print(x)


n = int(input())
d = []
p = 0
m = 0
for i in range(n):
	s = float(input())
	d.append(s)
	if s > 0:
		p = p + int(s)
	else:
		m = m + int(s)
a = p + m
s = d[::1]
s.sort()
if a == 0:
	for i in d:
		print(int(i))
elif a > 0:
	for i in d:
		if i >= 0:
			print(int(i))
		elif i == int(i):
			print(int(i))
		elif a > 0:
			a = a - 1
			print(int(i) - 1)
		else:
			print(int(i))
else:
	for i in d:
		if i < 0:
			print(int(i))
		elif i == int(i):
			print(int(i))
		elif a < 0:
			a = a + 1
			print(int(i) + 1)
		else:
			print(int(i))


n = int(input())
ans = []
p = []
a = 0
b = 0

def new_int(p):
	if int(p) == p:
		return int(p)
	if p < 0:
		return int(p) - 1
	return int(p)
for t in range(n):
	l = float(input())
	ans.append(new_int(l))
	if int(l) == l:
		p.append(0)
	else:
		p.append(1)
q = sum(ans)
k = 0
for t in range(len(ans)):
	if p[t] == 1 and k < abs(q):
		k += 1
		print(ans[t] + 1)
	else:
		print(ans[t])


import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop
import math

def main():
	n = int(input())
	a = [float(input()) for _ in range(n)]
	plus = list(filter(lambda x: x > 0, a))
	all_ceil_p = 0
	absolute_p = 0
	for p in plus:
		if math.floor(p) == math.ceil(p):
			absolute_p += int(p)
		else:
			all_ceil_p += math.floor(p)
	minus = list(filter(lambda x: x < 0, a))
	all_ceil_m = 0
	absolute_m = 0
	for m in minus:
		if math.floor(m) == math.ceil(m):
			absolute_m += int(m)
		else:
			all_ceil_m += math.ceil(m)
	total_p = all_ceil_p + absolute_p
	total_m = all_ceil_m + absolute_m
	count = abs(total_p - abs(total_m))
	if total_p > abs(total_m):
		for v in a:
			if math.floor(v) == math.ceil(v):
				print(math.ceil(v))
				continue
			if v >= 0:
				print(math.floor(v))
			elif count > 0:
				print(math.floor(v))
				count -= 1
			else:
				print(math.ceil(v))
	else:
		for v in a:
			if math.floor(v) == math.ceil(v):
				print(math.ceil(v))
				continue
			if v <= 0:
				print(math.ceil(v))
			elif count > 0:
				print(math.ceil(v))
				count -= 1
			else:
				print(math.floor(v))
main()


from sys import stdin, stdout, exit
from math import floor
n = int(stdin.readline())
bs = []
fs = []
for i in range(n):
	x = stdin.readline().strip()
	idx = x.find('.')
	i_part = int(x[:idx])
	f_part = int(x[idx + 1:])
	if x[0] == '-' and f_part != 0:
		i_part -= 1
		f_part = 100000 - f_part
	bs.append(i_part)
	fs.append(f_part)
s = sum(fs)
ans = []
for i in range(n):
	if s > 0 and fs[i] != 0:
		ans.append(bs[i] + 1)
		s -= 100000
	else:
		ans.append(bs[i])
stdout.write('\n'.join(map(str, ans)) + '\n')


n = int(input())
arr = [0 for i in range(n)]
flag = [0 for i in range(n)]
for i in range(n):
	arr[i] = float(input())
	if int(arr[i]) == arr[i]:
		flag[i] = 1
	if flag[i] == 0 and arr[i] < 0:
		arr[i] = int(arr[i]) - 1
	else:
		arr[i] = int(arr[i])
suma = sum(arr)
for i in range(n):
	if suma != 0:
		if flag[i] == 0:
			arr[i] += 1
			suma += 1
	else:
		break
for i in arr:
	print(i)


from math import ceil, floor
import sys

def main():
	input = sys.stdin.readline
	n = int(input())
	a = []
	l = [0 for k in range(n)]
	d = 0
	for k in range(n):
		t = float(input())
		if t != int(t):
			d += 1
		else:
			l[k] = 1
		a.append(floor(t))
	d = -sum(a)
	for k in range(n):
		if l[k] == 1:
			print(a[k])
		elif d > 0:
			print(a[k] + 1)
			d -= 1
		else:
			print(a[k])
main()


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
from math import ceil, floor
n = int(input())
a = []
for i in range(n):
	a.append(float(input()))
arr = [floor(i) for i in a]
s = sum(arr)
for i in range(n):
	if a[i] == int(a[i]):
		continue
	if s == 0:
		break
	s += 1
	arr[i] += 1
for i in arr:
	print(i)


n = int(input())
a = [float(input()) for i in range(n)]
b = a.copy()
s = 0
for i in range(0, n):
	b[i] = int(b[i])
	s = s + b[i]
if s != 0:
	for i in range(0, n):
		if s == 0:
			break
		if b[i] != a[i]:
			if s < 0 and b[i] >= 0 and (a[i] >= 0):
				b[i] = b[i] + 1
				s = s + 1
			elif s > 0 and b[i] < 0 and (a[i] < 0):
				b[i] = b[i] - 1
				s = s - 1
for i in range(0, n):
	print(b[i])


import math
a = []
b = []
t = int(input())
for i in range(t):
	n = float(input())
	a.append(math.floor(n))
	b.append(math.ceil(n))
l = 0 - sum(a)
i = 0
while i < len(a):
	if l > 0 and a[i] != b[i]:
		print(b[i])
		l -= 1
	else:
		print(a[i])
	i += 1


import math
n = int(input())
arr = []
t = [0] * n
sm = 0
for _ in range(n):
	i = float(input())
	if i >= 0:
		k = math.ceil(i)
		sm += k
		arr.append(k)
		if k == i:
			t[_] = 1
	else:
		k = math.floor(i)
		sm += k
		arr.append(k)
		if k == i:
			t[_] = 1
for (i, k) in enumerate(arr):
	if sm > 0:
		if k >= 0 and t[i] != 1:
			print(k - 1)
			sm -= 1
			continue
	elif sm < 0:
		if k < 0 and t[i] != 1:
			print(k + 1)
			sm += 1
			continue
	print(arr[i])


import math
t = int(input())
a = []
b = []
for i in range(t):
	n = float(input())
	a.append(n)
	if n < 0:
		b.append(math.ceil(n))
	else:
		b.append(math.floor(n))
k = sum(b)
if k == 0:
	for j in b:
		print(j)
if k < 0:
	for j in range(t):
		if a[j] > 0 and math.floor(a[j]) != math.ceil(a[j]):
			b[j] += 1
			k += 1
		if k == 0:
			break
	for j in b:
		print(j)
elif k > 0:
	for j in range(t):
		if a[j] < 0 and math.floor(a[j]) != math.ceil(a[j]):
			b[j] += -1
			k += -1
		if k == 0:
			break
	for j in b:
		print(j)


import math
n = int(input())
a = []
t = []
s = 0
for _ in range(n):
	f = float(input())
	p = 0
	if f.is_integer():
		t.append(0)
		p = int(f)
	else:
		p = int(math.floor(f))
		t.append(-1)
	a.append(p)
	s += p
for (i, e) in enumerate(a):
	if t[i] == 0:
		print(e)
	elif s == 0:
		print(e)
	else:
		print(e + 1)
		s += 1


n = int(input())
arr = [float(input()) for _ in range(n)]
arr2 = [int(arr[i]) for i in range(n)]
diff = sum(arr2)
if diff == 0:
	for i in range(n):
		print(arr2[i])
elif diff < 0:
	cnt = 0
	for i in range(n):
		if arr[i] > 0:
			if cnt < abs(diff):
				if arr[i] != arr2[i]:
					print(arr2[i] + 1)
					cnt += 1
				else:
					print(arr2[i])
			else:
				print(arr2[i])
		else:
			print(arr2[i])
else:
	cnt = 0
	for i in range(n):
		if arr[i] > 0:
			print(arr2[i])
		elif cnt < diff:
			if arr[i] != arr2[i]:
				print(arr2[i] - 1)
				cnt += 1
			else:
				print(arr2[i])
		else:
			print(arr2[i])


a = int(input())
ans = []
aller = [0 for i in range(a)]
for i in range(a):
	s = input()
	if s[0] == '-':
		s = s[1:]
		t = s.find('.')
		q = int(s[0:t])
		m = s[t + 1:]
		ans.append(-q)
		if len(m) == m.count('0'):
			aller[i] = 0
			continue
		aller[i] = 1
	else:
		t = s.find('.')
		q = int(s[0:t])
		ans.append(q)
		m = s[t + 1:]
		if len(m) == m.count('0'):
			aller[i] = 0
			continue
		aller[i] = -1
alpha = sum(ans)
for i in range(len(ans)):
	if alpha == 0:
		continue
	if aller[i] == 0:
		continue
	if aller[i] == 1 and alpha > 0:
		ans[i] -= 1
		alpha -= 1
		continue
	if aller[i] == -1 and alpha < 0:
		ans[i] += 1
		alpha += 1
		continue
for i in range(len(ans)):
	print(ans[i])


from math import floor
n = int(input())
a = [float(input()) for _ in range(n)]
b = [floor(i) for i in a]
s = sum(b)
i = 0
while s != 0:
	if int(a[i]) != a[i]:
		b[i] += 1
		s += 1
	i += 1
print(*b, sep='\n')


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def read_float_line():
	return [float(v) for v in sys.stdin.readline().split()]

def round(a):
	if a > 0:
		return math.floor(a)
	else:
		return math.floor(a)
n = read_int()
a = []
for i in range(n):
	x = read_float_line()
	a.append(x[0])
b = [round(a[i]) for i in range(n)]
s = sum(b)
i = 0
cnt = 0
while i < n and cnt < abs(s):
	if b[i] == a[i]:
		i += 1
		continue
	else:
		b[i] += 1
		i += 1
		cnt += 1
for i in range(n):
	print(b[i])


import math
n = int(input())
lst = [float(input()) for _ in range(n)]
nwlst = [round(x, 0) for x in lst]
sm = sum(nwlst)
for i in range(n):
	if lst[i] == nwlst[i] or sm == 0:
		print(int(nwlst[i]), end=' ')
		continue
	if sm > 0:
		if lst[i] < nwlst[i]:
			nwlst[i] -= 1
			sm -= 1
	if sm < 0:
		if lst[i] > nwlst[i]:
			nwlst[i] += 1
			sm += 1
	print(int(nwlst[i]), end=' ')


from math import floor
n = int(input())
(lst1, lst2) = (list(), list())
integers = list()
for i in range(n):
	lst1.append(float(input()))
	lst2.append(floor(lst1[-1]))
	integers.append(lst1[-1] == int(lst1[-1]))
s = -sum(lst2)
flag = 0
for i in range(len(lst2)):
	if s == flag:
		break
	if not integers[i]:
		lst2[i] += 1
		flag += 1
for elem in lst2:
	print(elem)


from math import *
n = int(input())
s = 0
ar = []
br = []
for i in range(n):
	x = float(input())
	ar.append(int(floor(x)))
	br.append(x - ar[i])
	s -= int(floor(x))
for i in range(n):
	if not s:
		break
	if br[i] != 0:
		s -= 1
		ar[i] += 1
for i in range(n):
	print(ar[i])


from math import floor, ceil
n = int(input())
ints = set()
arr = []
for i in range(n):
	f = float(input())
	if f == int(f):
		ints.add(i)
	arr.append(ceil(f))
s = sum(arr)
for i in range(n):
	if s == 0:
		for j in arr:
			print(j)
		exit()
	elif i not in ints:
		s -= 1
		arr[i] -= 1


import math
import sys
n = int(input())
a = [float(input()) for _ in range(n)]
s = sum(map(math.ceil, a))
for x in a:
	if s == 0 or x == math.ceil(x):
		sys.stdout.write('{}\n'.format(math.ceil(x)))
	else:
		sys.stdout.write('{}\n'.format(math.floor(x)))
		s -= 1


import sys
import math

def solve():
	n = int(input())
	real_nums = [float(input()) for _ in range(n)]
	results = []
	rappend = results.append
	ceil = math.ceil
	floor = math.floor
	cur_sum = 0
	for real_num in real_nums:
		int_num = ceil(real_num)
		cur_sum += int_num
		rappend(int_num)
	for (index, int_num) in enumerate(results):
		if cur_sum == 0:
			break
		real_num = real_nums[index]
		if ceil(real_num) != floor(real_num):
			results[index] = int_num - 1
			cur_sum -= 1
	for int_num in results:
		print(int_num)
solve()


n = int(input())
(a, b) = ([], [])
(sum, x) = (0, 0.0)
for i in range(n):
	x = float(input())
	a.append(x)
	b.append(int(x))
	sum += int(x)
if sum >= 0:
	i = 0
	while sum > 0 and i < n:
		if b[i] <= 0 and a[i] - b[i] != 0:
			b[i] = b[i] - 1
			sum = sum - 1
		i = i + 1
else:
	i = 0
	sum = -1 * sum
	while sum > 0 and i < n:
		if b[i] >= 0 and a[i] - b[i] != 0 and (a[i] > 0):
			b[i] = b[i] + 1
			sum = sum - 1
		i = i + 1
for i in b:
	print(i)


from math import ceil, floor
l = []
pos = 0
neg = 0
N = int(input())
flag = [1] * (N + 2)
for _ in range(N):
	x = float(input())
	l.append(int(x))
	if ceil(x) != floor(x):
		if x < 0:
			flag[_] = -1
	else:
		flag[_] = 2
	if x >= 0:
		pos += l[-1]
	else:
		neg += -l[-1]
for i in range(N):
	if pos == neg:
		break
	if pos < neg and l[i] >= 0 and (flag[i] == 1):
		l[i] += 1
		pos += 1
		if pos == neg:
			break
	if neg < pos and l[i] < 0 and (flag[i] == -1):
		l[i] -= 1
		neg += 1
		if pos == neg:
			break
for i in l:
	print(i)


import collections as cc
import math as mt
import sys
I = lambda : list(map(int, input().split()))
(n,) = I()
a = []
for i in range(n):
	a.append(float(input()))
su = 0
te = []
for i in a:
	su += mt.floor(i)
	te.append(mt.floor(i))
if su == 0:
	for i in te:
		print(i)
	sys.exit()
i = 0
while su and i < n:
	if a[i] % 1 != 0:
		su += 1
		te[i] = mt.ceil(a[i])
	i += 1
for i in te:
	print(i)


import math as mt
N = int(100000.0 + 5000)
n = int(input())
(a, b, s) = [[0] * N, [0] * N, int(0)]

def check(a, b):
	if a == b:
		return 0
	else:
		return 1

def prc():
	for i in range(1, n + 1):
		print(b[i])
	return
for i in range(1, n + 1):
	a[i] = float(input())
	b[i] = mt.floor(a[i])
	s += b[i]
if s < 0:
	for i in range(1, n + 1):
		if check(a[i], float(b[i])) == 1:
			b[i] = mt.ceil(a[i])
			s += 1
		if s == 0:
			break
prc()


n = int(input())
S = []
W = []
c = 0
for i in range(n):
	x = float(input())
	S.append(int(x))
	if x % 1 == 0:
		W.append(0)
	elif x > 0:
		W.append(1)
	else:
		W.append(-1)
	if x % 1:
		if x >= 0:
			c += x % 1
		else:
			c += x % 1
			c -= 1
c = round(c)
if c == 0:
	pass
elif c < 0:
	for i in range(len(S)):
		if W[i] == -1:
			S[i] -= 1
			c += 1
		if c == 0:
			break
else:
	for i in range(len(S)):
		if W[i] == 1:
			S[i] += 1
			c -= 1
		if c == 0:
			break
print('\n'.join(list(map(str, S))))


n = int(input())
a = []
b = [0 for i in range(n)]
sum = 0
for i in range(n):
	s = input()
	j = 0
	for p in s:
		if p == '.':
			break
		j += 1
	if s[0] == '-':
		if s[1] == '0':
			a.append('0')
		else:
			a.append(int(s[:j]))
		sum += -1 * int(s[j + 1:])
		if s[j + 1:] == '0' * 5:
			b[i] = 1
	else:
		a.append(int(s[:j]))
		sum += int(s[j + 1:])
		if s[j + 1:] == '0' * 5:
			b[i] = 1
sum = sum // 10 ** 5
if sum < 0:
	sum = abs(sum)
	for i in range(n):
		if sum > 0 and b[i] == 0:
			if a[i] == '0':
				print(-1)
				sum -= 1
			elif a[i] < 0:
				print(a[i] - 1)
				sum -= 1
			else:
				print(a[i])
		else:
			print(int(a[i]))
else:
	sum = abs(sum)
	for i in range(n):
		if sum > 0 and b[i] == 0:
			if a[i] == '0':
				print(0)
			elif a[i] >= 0:
				print(a[i] + 1)
				sum -= 1
			else:
				print(a[i])
		else:
			print(int(a[i]))


n = int(input())
original = []
control = []
for i in range(n):
	a = float(input())
	original.append(a)
	control.append(int(a))
sum_all = sum(control)
if sum_all > 0:
	while sum_all > 0:
		for i in range(len(control)):
			if control[i] > original[i]:
				control[i] -= 1
				sum_all -= 1
				if sum_all == 0:
					break
elif sum_all < 0:
	while sum_all < 0:
		for i in range(len(control)):
			if control[i] < original[i]:
				control[i] += 1
				sum_all += 1
				if sum_all == 0:
					break
for i in range(len(control)):
	print(control[i])


import math
n = int(input())
B = []
itg = []
sumn = 0
for i in range(n):
	b = float(input())
	if math.ceil(b) == math.floor(b):
		itg.append(1)
	else:
		itg.append(0)
	B.append(math.ceil(b))
	sumn += math.ceil(b)
for i in range(n):
	if sumn > 0 and itg[i] != 1:
		sumn -= 1
		B[i] -= 1
	print(B[i])


import math
n = int(input())
nums = []
for _ in range(n):
	nums.append(float(input()))
rest_nums = [math.ceil(x) - x for x in nums]
new_nums = [math.ceil(x) for x in nums]
t = int(round(sum(rest_nums)))
i = 0
x = 0
while x < t:
	if rest_nums[i] > 0:
		new_nums[i] -= 1
		x += 1
	i += 1
for x in new_nums:
	print(x)


import sys, math

def read_int():
	return int(sys.stdin.readline().strip())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

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

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)

def print_list(l, delim=' '):
	print(delim.join(map(str, l)))
n = read_int()
arr = [0 for _ in range(n)]
mask = [0 for _ in range(n)]
for i in range(n):
	a = float(sys.stdin.readline().strip())
	arr[i] = int(a)
	if a == arr[i]:
		mask[i] = 0
	elif a > 0:
		mask[i] = 1
	else:
		mask[i] = -1
suma = sum(arr)
if suma == 0:
	print_list(arr, '\n')
else:
	for i in range(n):
		if mask[i] != 0:
			if suma > 0:
				if mask[i] < 0:
					print(arr[i] - 1)
					suma -= 1
				else:
					print(arr[i])
			elif suma < 0:
				if mask[i] > 0:
					print(arr[i] + 1)
					suma += 1
				else:
					print(arr[i])
			else:
				print(arr[i])
		else:
			print(arr[i])


import heapq
import math
n = int(input())
a = [None] * n
h = []
mh = []
s = 0
d = [0] * n
for i in range(n):
	a[i] = float(input())
	if a[i] != int(a[i]):
		if a[i] < 0:
			heapq.heappush(h, [math.floor(a[i]) - math.ceil(a[i]), i])
		else:
			heapq.heappush(mh, [math.ceil(a[i]) - math.floor(a[i]), i])
	s += int(a[i])
	d[i] = int(a[i])
if s == 0:
	mfff = 0
elif s > 0:
	for i in range(s):
		k = heapq.heappop(h)
		if a[k[1]] < 0:
			d[k[1]] = math.floor(a[k[1]])
		else:
			d[k[1]] = math.ceil(a[k[1]])
else:
	for i in range(-s):
		k = heapq.heappop(mh)
		if a[k[1]] < 0:
			d[k[1]] = math.floor(a[k[1]])
		else:
			d[k[1]] = math.ceil(a[k[1]])
for i in range(n):
	print(int(d[i]))


from math import ceil, floor
t = int(input())
num = []
while t > 0:
	n = float(input())
	num.append(n)
	t -= 1
up = [ceil(x) for x in num]
down = [floor(x) for x in num]
s = sum(up)
for i in range(len(num)):
	if s > 0:
		if down[i] < up[i]:
			print(down[i])
			s -= 1
		else:
			print(up[i])
	else:
		print(up[i])


import math

def main():
	n = int(input())
	b = []
	a = []
	pos_sum = 0
	neg_sum = 0
	for i in range(n):
		x = float(input())
		a.append(x)
		if x > 0:
			x = math.floor(x)
			pos_sum += x
		else:
			x = math.ceil(x)
			neg_sum += -x
		b.append(x)
	target_sum = max(pos_sum, neg_sum)
	pos_cnt = target_sum - pos_sum
	neg_cnt = target_sum - neg_sum
	for i in range(n):
		if not a[i].is_integer():
			if a[i] > 0 and b[i] >= 0 and (pos_cnt > 0):
				b[i] += 1
				pos_cnt -= 1
			elif a[i] < 0 and b[i] <= 0 < neg_cnt:
				b[i] -= 1
				neg_cnt -= 1
	for i in b:
		print(i)
main()


n = int(input())
a = []
x = []
for i in range(n):
	X = float(input())
	x.append(X)
	a.append(int(X))
if sum(a) == 0:
	for i in range(n):
		print(a[i])
else:
	diff = sum(a)
	if diff < 0:
		for i in range(n):
			if a[i] < x[i]:
				a[i] += 1
				diff += 1
				if diff == 0:
					break
	elif diff > 0:
		for i in range(n):
			if a[i] > x[i]:
				a[i] -= 1
				diff -= 1
				if diff == 0:
					break
	for i in range(n):
		print(a[i])


import sys, math
input = sys.stdin.readline
n = int(input())
numbers = []
for _ in range(n):
	numbers.append(float(input()))
result = []
s = 0
for number in numbers:
	result.append(math.ceil(number))
	s += result[-1]
i = 0
while s != 0:
	floored = math.floor(numbers[i])
	if result[i] != floored:
		result[i] = floored
		s -= 1
	i += 1
for number in result:
	print(number)


import math
n = int(input())
nums = []
for i in range(n):
	nums.append(float(input()))
sum = 0
for num in nums:
	if num >= 0:
		sum += math.floor(num)
	else:
		sum += math.ceil(num)
for num in nums:
	if num > 0:
		if sum < 0:
			print(math.ceil(num))
			if math.ceil(num) > math.floor(num):
				sum += 1
		else:
			print(math.floor(num))
	elif num < 0:
		if sum > 0:
			print(math.floor(num))
			if math.floor(num) < math.ceil(num):
				sum -= 1
		else:
			print(math.ceil(num))
	else:
		print(math.floor(num))


n = int(input())
a = []
b = 0
c = 0
d = []
for i in range(n):
	a.append(float(input()))
	if a[i] > 0:
		b = b + 1
	else:
		c = c + 1
	d.append(int(a[i]))
e = sum(d)
if e > 0:
	for i in range(n):
		if a[i] != int(a[i]) and a[i] < 0:
			d[i] -= 1
			e -= 1
		if e == 0:
			break
elif e < 0:
	for i in range(n):
		if a[i] != int(a[i]) and a[i] > 0:
			d[i] += 1
			e += 1
		if e == 0:
			break
for i in range(n):
	print(d[i])


from sys import stdin
from math import floor, ceil
n = int(input())
aa = map(float, stdin.readlines())
acc = 0
res = []
for a in aa:
	f = floor(a)
	c = ceil(a)
	if c - a <= acc + 1e-06:
		res.append(str(c))
		acc -= c - a
	else:
		res.append(str(f))
		acc += a - f
print('\n'.join(res))


import math
n = int(input())
l = []
p = []
for i in range(n):
	x = float(input())
	l.append(x)
	p.append(math.ceil(x))
som = sum(p)
i = 0
while i < len(l) and som != 0:
	if l[i] != int(l[i]):
		p[i] = p[i] - 1
		som -= 1
	i = i + 1
for i in p:
	print(i)


import math
n = int(input())
l = []
s = 0
for i in range(n):
	l.append(float(input()))
	s += math.ceil(l[-1])
for i in range(len(l)):
	if l[i] == math.ceil(l[i]):
		l[i] = [math.ceil(l[i]), 1]
	else:
		l[i] = [math.ceil(l[i]), 0]
for i in range(len(l)):
	if s > 0:
		if l[i][1] == 0:
			l[i][0] -= 1
			s -= 1
	else:
		break
for i in range(len(l)):
	l[i] = l[i][0]
print(*l)


n = int(input())
l = []
ans = []
for i in range(n):
	s = float(input())
	if int(s) == s:
		ans.append(int(s))
		l.append(0)
	elif s < 0:
		ans.append(int(s))
		l.append(1)
	else:
		ans.append(int(s) + 1)
		l.append(1)
diff = sum(ans)
if diff == 0:
	for i in ans:
		print(i)
elif diff > 0:
	for i in range(len(ans)):
		if l[i] != 0:
			ans[i] -= 1
			diff -= 1
		if diff == 0:
			break
	for i in ans:
		print(i)


import copy
import math
n = int(input())
arr = []
for i in range(n):
	arr.append(float(input()))
s = 0
array = copy.deepcopy(arr)
for i in range(n):
	array[i] = math.floor(array[i])
	s += array[i]
ptr = 0
while s != 0:
	if arr[ptr] % 1 != 0:
		array[ptr] += 1
		s += 1
	ptr += 1
print(*array)


import sys
import math
n = int(input())
t = 0
for _ in range(n):
	s = float(sys.stdin.readline())
	if s == int(s):
		print(int(s))
	elif t > 0:
		if s > 0:
			print(int(s))
			t -= s - int(s)
		else:
			print(-math.ceil(abs(s)))
			t -= math.ceil(abs(s)) + s
	elif t <= 0:
		print(math.ceil(s))
		t += math.ceil(s) - s


import math
n = int(input())
a = []
s = 0
for i in range(n):
	k = float(input())
	a.append(k)
	s += math.floor(k)
ch = abs(s)
i = 0
while ch != 0:
	if math.floor(a[i]) == math.ceil(a[i]):
		print(math.floor(a[i]))
		i += 1
	else:
		print(math.ceil(a[i]))
		ch -= 1
		i += 1
for j in range(i, n):
	print(math.floor(a[j]))


import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
n = int(input())
a = []
for i in range(n):
	a.append(float(input().strip()))
z = [int(i) for i in a]
diff = sum(z)
if diff == 0:
	for i in z:
		print(i)
elif diff > 0:
	for i in range(n):
		if z[i] != a[i] and z[i] <= 0 and (a[i] <= 0) and diff:
			print(z[i] - 1)
			diff -= 1
		else:
			print(z[i])
else:
	for i in range(n):
		if z[i] != a[i] and z[i] >= 0 and (a[i] >= 0) and (diff != 0):
			print(z[i] + 1)
			diff += 1
		else:
			print(z[i])


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

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

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
a = []
for i in range(n):
	a.append(float(input()))
neg = 0
pos = 0
ans = []
flag = defaultdict(bool)
for j in range(n):
	i = a[j]
	if i > 0:
		l = int(i)
		r = l + (i - l != 0)
		flag[j] = l != r
		pos += l
	else:
		l = int(i)
		r = l - (i - l != 0)
		flag[j] = l != r
		neg += abs(l)
	ans.append(l)
needP = 0
needN = 0
if pos > neg:
	needN = pos - neg
if pos < neg:
	needP = neg - pos
for i in range(n):
	if not flag[i]:
		continue
	else:
		if a[i] > 0 and needP:
			needP -= 1
			ans[i] += 1
		if a[i] < 0 and needN:
			needN -= 1
			ans[i] -= 1
for i in ans:
	print(i)


a = []
d = {}
e = {}
f = {}
t = int(input())
for _ in range(t):
	c = float(input())
	if c % 1 == 0:
		d[_] = 1
	elif 0 < c < 1:
		e[_] = 1
	elif -1 < c < 0:
		f[_] = 1
	a.append(int(c))
t = 0
for i in a:
	t += i
i = 0
while t != 0:
	if i not in d:
		if t > 0:
			if a[i] < 0:
				a[i] -= 1
				t -= 1
			elif a[i] == 0 and i in f:
				a[i] -= 1
				t -= 1
		elif a[i] > 0:
			a[i] += 1
			t += 1
		elif a[i] == 0 and i in e:
			a[i] += 1
			t += 1
	i += 1
for i in a:
	print(i)


import math
from sys import stdin, stdout
n = int(stdin.readline())
tst = []
a = []
for i in range(n):
	x = float(stdin.readline())
	a.append(math.floor(x))
	tst.append((math.floor(x), math.ceil(x)))
val = sum(a)
val = -val
for i in range(n):
	if val == 0:
		break
	if tst[i][0] == tst[i][1]:
		continue
	if val > 0:
		a[i] += 1
		val -= 1
	if val < 0:
		a[i] -= 1
		val += 1
for x in a:
	stdout.write(str(x) + '\n')


import sys
from math import ceil, floor
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	n = int(input())
	a = []
	for i in range(n):
		a.append(float(input()))
	intcnt = 0
	for num in a:
		if ceil(num) == floor(num):
			intcnt += 1
	non_int = n - intcnt
	minsum = 0
	ans = []
	for num in a:
		minsum += floor(num)
		ans.append(floor(num))
	if abs(minsum) <= non_int:
		cnt = abs(minsum)
		for i in range(n):
			if cnt == 0:
				break
			if floor(a[i]) != ceil(a[i]):
				ans[i] += 1
				cnt -= 1
		for num in ans:
			print(num)
	else:
		maxsum = 0
		newans = []
		for num in a:
			maxsum += ceil(num)
			ans.append(ceil(num))
		assert maxsum <= non_int
		for i in range(n):
			if maxsum == 0:
				break
			if floor(a[i]) != ceil(a[i]):
				ans[i] -= 1
				maxsum -= 1
		for num in ans:
			print(num)


def answer(n, A):
	s = 0
	ans = []
	for i in range(n):
		s += int(A[i])
		ans.append(int(A[i]))
	for i in range(n):
		if s == 0:
			break
		elif s > 0:
			if A[i] != int(A[i]):
				if A[i] < 0:
					ans[i] -= 1
					s -= 1
		elif A[i] != int(A[i]):
			if A[i] > 0:
				ans[i] += 1
				s += 1
	return ans
	return A
n = int(input())
arr = []
for i in range(n):
	x = float(input())
	arr.append(x)
ans = answer(n, arr)
for i in ans:
	print(i)


def main():
	n = int(input())
	ans = []
	total = 0
	for i in range(n):
		x = float(input())
		ans.append([x, int(x)])
		total += int(x)
	if total < 0:
		for i in range(n):
			if ans[i][0] >= 0 and ans[i][0] != int(ans[i][0]):
				ans[i][1] += 1
				total += 1
			if total == 0:
				break
	elif total > 0:
		for i in range(n):
			if ans[i][0] <= 0 and ans[i][0] != int(ans[i][0]):
				ans[i][1] -= 1
				total -= 1
			if total == 0:
				break
	for i in range(n):
		print(ans[i][1])
main()


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt, log2, floor
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def modefiedSieve():
	mx = 10 ** 7 + 1
	sieve = [-1] * mx
	for i in range(2, mx):
		if sieve[i] == -1:
			sieve[i] = i
			for j in range(i * i, mx, i):
				if sieve[j] == -1:
					sieve[j] = i
	return sieve

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

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

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

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n + 1)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def maxSubArraySum(a, size):
	maxint = 10 ** 10
	max_so_far = -maxint - 1
	max_ending_here = 0
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def countSetBits(n):
	count = 0
	while n:
		n &= n - 1
		count += 1
	return count

def solve():
	(positive, negative) = (0, 0)
	arr = []
	n = int(input())
	for _ in range(n):
		num = float(input())
		if num >= 0:
			arr.append([math.floor(num), math.ceil(num)])
			positive += math.floor(num)
		else:
			arr.append([math.ceil(num), math.floor(num)])
			negative += math.ceil(num)
	diff = positive + negative
	if diff == 0:
		for (u, v) in arr:
			print(u)
	elif diff < 0:
		diff = abs(diff)
		for (u, v) in arr:
			if u < 0:
				print(u)
			elif diff == 0:
				print(u)
			elif u != v and v > 0:
				print(v)
				diff -= 1
			else:
				print(u)
	else:
		for (u, v) in arr:
			if u > 0:
				print(u)
			elif diff == 0:
				print(u)
			elif u != v and v < 0:
				print(v)
				diff -= 1
			else:
				print(u)
t = 1
for _ in range(t):
	solve()


n = int(input())
a = list(((0, 0) for _ in range(n)))
s = 0
for i in range(n):
	x = float(input())
	y = int(x)
	z = y + (abs(int(x)) < abs(x))
	if x < 0 and z > y:
		y -= 1
		z -= 1
	a[i] = (y, z)
	s += y
res = [0] * n
for i in range(n):
	if s < 0 and a[i][0] != a[i][1]:
		res[i] = a[i][0] + 1
		s += 1
	else:
		res[i] = a[i][0]
print('\n'.join(map(str, res)))


from sys import stdin
import collections
import math
import queue
n = int(stdin.readline().strip())
original = []
after = []
for _ in range(n):
	num = float(stdin.readline().strip())
	original.append(num)
	after.append(math.floor(num))
if sum(after) == 0:
	for i in after:
		print(i)
	exit()
cur = sum(after)
i = 0
while cur < 0 and i < n:
	if math.ceil(original[i]) > math.floor(original[i]):
		after[i] = math.ceil(original[i])
		cur += 1
	i += 1
for i in after:
	print(i)


import sys
from collections import Counter
import itertools
from math import floor, ceil

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

def dinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def main():
	q = int(input())
	w = []
	z = []
	v = 0
	x = 0
	for i in range(q):
		w.append(float(input()))
		z.append(None)
		if not w[i] % 1:
			z[i] = int(w[i])
			v += int(w[i])
		elif w[i] > 0:
			x += 1
			v += ceil(w[i])
			z[i] = ceil(w[i])
		else:
			v += floor(w[i])
			z[i] = floor(w[i])
	if v > 0:
		c = abs(v)
		for i in range(q):
			if w[i] % 1 and w[i] > 0 and c:
				z[i] = floor(w[i])
				c -= 1
	else:
		c = abs(v)
		for i in range(q):
			if w[i] % 1 and w[i] < 0 and c:
				z[i] = ceil(w[i])
				c -= 1
	for i in range(q):
		print(z[i])
main()


import math
n = int(input())
a = []
for i in range(n):
	a.append(float(input()))
floored = [math.floor(i) for i in a]
all_sum = sum(floored)
answer = floored
if all_sum != 0:
	dif = abs(all_sum)
	i = 0
	while dif > 0:
		if a[i] > floored[i]:
			dif -= 1
			answer[i] += 1
		i += 1
for x in answer:
	print(x)


import math as m
a = []
p = []
q = []
for i in range(int(input())):
	x = float(input())
	if i % 2:
		y = m.ceil(x)
		if y != x:
			p.append(i)
	else:
		y = m.floor(x)
		if y != x:
			q.append(i)
	a.append(y)
s = sum(a)
if s > 0:
	j = 0
	while s:
		a[p[j]] -= 1
		j += 1
		s -= 1
elif s < 0:
	j = 0
	while s:
		a[q[j]] += 1
		j += 1
		s += 1
for i in range(len(a)):
	print(a[i])


from math import floor, ceil
n = int(input())
arr = []
for i in range(n):
	arr.append(float(input()))
k = [floor(i) for i in arr]
delta = -sum(k)
for i in range(n):
	if int(arr[i]) != arr[i] and delta:
		delta -= 1
		print(ceil(arr[i]))
	else:
		print(floor(arr[i]))


from sys import stdin
input = stdin.readline
n = int(input())
a = []
for i in range(n):
	(b, c) = map(str, input().split('.'))
	k = int(b)
	if c == '0' * 5 + '\n':
		a.append([k, k])
	elif k > 0:
		a.append([k, k + 1])
	elif k < 0:
		a.append([k - 1, k])
	elif b[0] == '-':
		a.append([-1, 0])
	else:
		a.append([0, 1])
ba = 0
for i in a:
	ba += i[1]
ans = []
for i in a:
	if ba > 0 and i[0] != i[1]:
		ba -= 1
		ans.append(i[0])
	else:
		ans.append(i[1])
for i in ans:
	print(i)


import sys
from math import floor
input = sys.stdin.readline
n = int(input())
l = []
for _ in range(n):
	l.append(float(input()))
s = [floor(x) for x in l]
total = sum(s)
i = 0
while total < 0:
	if l[i] != s[i]:
		s[i] += 1
		total += 1
	i += 1
for x in s:
	print(x)


def main():
	n = int(input())
	i = 0
	ng = []
	tp = []
	tg = 0
	while i < n:
		str = input()
		(x, y) = [int(t) for t in str.split('.')]
		if y != 0:
			tg += x if x >= 0 and str[0] != '-' else x - 1
			ng.append(x if x >= 0 and str[0] != '-' else x - 1)
		else:
			tg += x
			ng.append(x)
		tp.append(y)
		i += 1
	i = 0
	while i < n:
		if tp[i] == 0 or tg == 0:
			print(ng[i])
		else:
			print(ng[i] + 1)
			tg += 1
		i += 1
main()


n = int(input())
a = []
f = [0] * n
s = 0
for i in range(n):
	ch = float(input())
	a.append(round(ch))
	if ch < round(ch):
		f[i] = -1
	elif ch > round(ch):
		f[i] = 1
	s += round(ch)
sa = abs(s)
if s == 0:
	for i in range(n):
		print(a[i])
else:
	for i in range(n):
		if sa > 0 and s < 0 and (f[i] == 1):
			a[i] += f[i]
			sa -= 1
		elif sa > 0 and s > 0 and (f[i] == -1):
			a[i] += f[i]
			sa -= 1
		print(a[i])


import math
n = int(input())
w = []
A = 0
D = 0
for i in range(0, n):
	f = float(input())
	w.append(f)
	if f < 0:
		A += math.ceil(f)
	else:
		D += math.floor(f)
A = abs(A)
D = abs(D)
T = abs(A - D)
if A == D and T == 0:
	for i in range(0, len(w)):
		if w[i] < 0:
			print(math.ceil(w[i]), end=' ')
		else:
			print(math.floor(w[i]), end=' ')
elif A > D:
	for i in range(0, len(w)):
		if T != 0:
			if w[i] >= 0 and int(w[i]) != w[i]:
				print(math.ceil(w[i]), end=' ')
				T -= 1
			elif w[i] < 0:
				print(math.ceil(w[i]), end=' ')
			else:
				print(math.ceil(w[i]), end=' ')
		elif w[i] < 0:
			print(math.ceil(w[i]), end=' ')
		else:
			print(math.floor(w[i]), end=' ')
else:
	for i in range(0, len(w)):
		if T != 0:
			if w[i] < 0 and int(w[i]) != w[i]:
				print(math.floor(w[i]), end=' ')
				T -= 1
			elif w[i] < 0:
				print(math.floor(w[i]), end=' ')
			else:
				print(math.floor(w[i]), end=' ')
		elif w[i] < 0:
			print(math.ceil(w[i]), end=' ')
		else:
			print(math.floor(w[i]), end=' ')


n = int(input())
ai = [float(input()) for i in range(n)]
bi = [0] * n
for i in range(n):
	bi[i] = int(ai[i])
	if ai[i] < 0 and ai[i] != int(ai[i]):
		bi[i] -= 1
num = sum(bi)
for i in range(n):
	if num != 0 and ai[i] != int(ai[i]):
		bi[i] += 1
		num += 1
	print(bi[i])


import math
n = int(input())
a = [float(input()) for i in range(n)]
b = [math.ceil(i) for i in a]
s = sum(b)
for i in range(n):
	if int(a[i]) != a[i]:
		b[i] -= 1
		s -= 1
	if s == 0:
		break
for i in b:
	print(i)


n = int(input())
a = []
sum = 0
for i in range(n):
	x = float(input())
	sum += int(x)
	a.append(x)
for i in range(n):
	x = a[i]
	check = x != int(x)
	if sum > 0 and x < 0 and check:
		print(int(x) - 1)
		sum -= 1
	elif sum < 0 and x > 0 and check:
		print(int(x) + 1)
		sum += 1
	else:
		print(int(x))


n = int(input())
possible = []
arr = []
tot = 0
for x in range(n):
	string = input()
	if string[-6:] == '.00000':
		possible.append(False)
	else:
		possible.append(True)
	arr.append(int(string[:-6]))
	if possible[x] and string[0] == '-':
		arr[x] -= 1
	tot += arr[x]
pos = 0
while tot != 0:
	if possible[pos]:
		arr[pos] += 1
		tot += 1
	pos += 1
for x in range(n):
	print(arr[x])


from math import ceil
from math import floor
n = int(input())
a = []
b = []
s = 0
cou = 0
for i in range(n):
	x = float(input())
	a.append(x)
	y = floor(x)
	s += y
cou = -s
for i in range(n):
	if a[i] != floor(a[i]) and cou > 0:
		b.append(ceil(a[i]))
		cou -= 1
	else:
		b.append(floor(a[i]))
print(*b, sep='\n')


import math
import sys
n = int(sys.stdin.readline())
a = []
int_arr = []
for x in range(n):
	v = float(sys.stdin.readline())
	a.append(math.floor(v))
	if math.floor(v) == v:
		int_arr.append(1)
	else:
		int_arr.append(0)
val = sum(a)
val = abs(val)
if val != 0:
	for w in range(len(a)):
		if int_arr[w] == 0 and val > 0:
			a[w] += 1
			val -= 1
for p in range(len(a)):
	a[p] = str(a[p])
print('\n'.join(a))


import math
n = int(input())
ceil = []
floor = []
s1 = 0
s2 = 0
arr = []
for _ in range(n):
	c = float(input())
	arr.append(c)
	ceil.append(math.ceil(c))
	s1 = s1 + math.ceil(c)
	floor.append(math.floor(c))
	s2 = s2 + math.floor(c)
s1 = abs(s1)
s2 = abs(s2)
if s1 == 0:
	for u in ceil:
		print(u)
elif s2 == 0:
	for u in floor:
		print(u)
elif s1 > s2:
	count = s2
	for i in range(0, len(arr)):
		if count > 0 and math.ceil(arr[i]) != math.floor(arr[i]):
			print(math.ceil(arr[i]))
			count = count - 1
		else:
			print(math.floor(arr[i]))
else:
	count = s1
	for i in range(0, len(arr)):
		if count > 0 and math.ceil(arr[i]) != math.floor(arr[i]):
			print(math.floor(arr[i]))
			count = count - 1
		else:
			print(math.ceil(arr[i]))


from math import *
import sys
input = sys.stdin.readline
n = int(input())
l = []
l2 = []
for i in range(n):
	bib = float(input())
	l.append(bib)
	if int(bib) == bib:
		l2.append(bib)
	else:
		l2.append(ceil(bib))
ss = sum(l2)
ind = 0
for i in range(n):
	if l[i] != l2[i]:
		if ss > 0:
			l2[i] -= 1
			ss -= 1
		if ss == 0:
			break
for i in l2:
	print(int(i))


g = 0
h = []
a = int(input())
for i in range(a):
	s = float(input())
	g += int(s)
	if float(int(s)) == s:
		k = False
	else:
		k = True
	h.append([int(s), k, s > 0])
for i in range(len(h)):
	if g == 0:
		break
	if not h[i][1]:
		continue
	if g < 0:
		if h[i][0] > 0 or (h[i][0] >= 0 and h[i][2]):
			h[i][0] += 1
			g += 1
	elif h[i][0] < 0:
		h[i][0] -= 1
		g -= 1
for i in h:
	print(i[0])


from math import ceil
n = int(input())
a = []
ori = []
for i in range(n):
	x = float(input())
	ori.append(x)
	a.append([i, ceil(x)])
a = sorted(a, key=lambda x: x[1], reverse=True)
S = sum([x[1] for x in a])
i = 0
while S > 0:
	if abs(a[i][1] - ori[a[i][0]]) == 0:
		i += 1
		continue
	a[i][1] -= 1
	i += 1
	S -= 1
b = [0] * n
for x in a:
	b[x[0]] = x[1]
for x in b:
	print(x)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
total = 0
inte = []
pos = []
neg = []
for s in range(n):
	num1 = input().split('.')
	num = list(map(int, num1))
	if sum(num) == num[0]:
		total += num[0]
		inte.append((num[0], s))
	elif num1[0][0] != '-':
		pos.append([num[0], s])
		total += num[0]
	else:
		neg.append([num[0] - 1, s])
		total += num[0] - 1
for i in range(len(pos)):
	if total < 0:
		pos[i][0] += 1
		total += 1
	else:
		break
for i in range(len(neg)):
	if total < 0:
		neg[i][0] += 1
		total += 1
	else:
		break
ans = inte + pos + neg
ans.sort(key=lambda x: x[1])
for i in range(n):
	print(ans[i][0])


a = []
n = int(input())
for i in range(n):
	a.append(float(input()))
b = []
s = 0
for i in range(n):
	b.append(int(a[i]))
	s += b[i]
i = 0
for i in range(n):
	if s == 0:
		break
	if s > 0:
		if a[i] >= b[i]:
			continue
		else:
			b[i] -= 1
			s -= 1
	elif a[i] <= b[i]:
		continue
	else:
		b[i] += 1
		s += 1
for i in b:
	print(i)


import math
n = int(input())
lower = []
higher = []
for _ in range(n):
	x = float(input())
	lower.append(math.floor(x))
	higher.append(math.ceil(x))
s = sum(lower)
sol = lower.copy()
i = 0
for (h, l) in zip(higher, lower):
	if s == 0:
		break
	s += h - l
	sol[i] = h
	i += 1
for x in sol:
	print(x)


n = int(input())
mas = []
checker = []
tmp = ''
for i in range(n):
	num = input()
	for (ind, item) in enumerate(num):
		if item != '.':
			tmp = tmp + item
		else:
			if tmp == '-0':
				mas.append('-0')
			else:
				mas.append(int(tmp))
			tmp = ''
			for j in range(ind + 1, len(num)):
				if num[j] != '0':
					checker.append(True)
					break
				if j == len(num) - 1 and num[j] == '0':
					checker.append(False)
			break
summa = 0
for item in mas:
	if item == '-0':
		summa += 0
	else:
		summa += item
if summa != 0:
	if summa > 0:
		for (ind, item) in enumerate(mas):
			if checker[ind]:
				if item == '-0':
					mas[ind] = -1
					summa -= 1
				elif item < 0:
					mas[ind] -= 1
					summa -= 1
				if summa == 0:
					break
	elif summa < 0:
		for (ind, item) in enumerate(mas):
			if checker[ind]:
				if item == '-0':
					continue
				elif item >= 0:
					mas[ind] += 1
					summa += 1
				if summa == 0:
					break
for item in mas:
	if item == '-0':
		print(0)
	else:
		print(item)


import sys
import os
from io import IOBase, BytesIO

def main():
	n = int(input())
	a = [0] * n
	for i in range(n):
		a[i] = float(input())
	b = [0] * n
	from math import ceil, floor
	for i in range(n):
		b[i] = round(a[i])
	total = sum(b)
	if total < 0:
		for i in range(n):
			if total == 0:
				break
			if b[i] >= 0 and a[i] != int(a[i]) and (a[i] > 0):
				if b[i] + 1 == ceil(a[i]):
					b[i] += 1
					total += 1
	if total > 0:
		for i in range(n):
			if total == 0:
				break
			if b[i] <= 0 and a[i] != int(a[i]) and (a[i] < 0):
				if b[i] - 1 == floor(a[i]):
					b[i] -= 1
					total -= 1
	for i in b:
		print(i)
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		py2 = round(0.5)
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2 == 1:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

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


import sys
import math
from collections import Counter
from operator import itemgetter
import queue

def IO():
	sys.stdin = open('pyinput.txt', 'r')
	sys.stdout = open('pyoutput.txt', 'w')

def GCD(a, b):
	if b == 0:
		return a
	else:
		return GCD(b, a % b)

def LCM(a, b):
	return a * (b // GCD(a, b))

def scan(TYPE_1, TYPE_2=0):
	if TYPE_1 == int:
		return map(int, sys.stdin.readline().strip().split())
	elif TYPE_1 == float:
		return map(float, sys.stdin.readline().strip().split())
	elif TYPE_1 == list and TYPE_2 == float:
		return list(map(float, sys.stdin.readline().strip().split()))
	elif TYPE_1 == list and TYPE_2 == int:
		return list(map(int, sys.stdin.readline().strip().split()))
	elif TYPE_1 == str:
		return sys.stdin.readline().strip()
	else:
		print('ERROR!!!!')

def main():
	n = int(input())
	a = []
	x = []
	s = 0
	for i in range(n):
		x.append(float(scan(str)))
		a.append(int(x[i]))
		s += a[i]
	for i in range(n):
		if s < 0 and a[i] >= 0 and (x[i] > 0) and (float(a[i]) - x[i] != 0):
			a[i] += 1
			s += 1
		if s > 0 and a[i] <= 0 and (x[i] < 0) and (float(a[i]) - x[i] != 0):
			a[i] -= 1
			s -= 1
	print(*a, sep='\n')
main()


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
from decimal import *
getcontext().prec = 100
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def dist(x, y, c, d):
	return (x - c) ** 2 + (y - d) ** 2

def circle(x1, y1, x2, y2, r1, r2):
	distSq = ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) ** 0.5
	if distSq + r2 <= r1:
		return True
	else:
		return False
	print(c[i][1], end=' ')
n = I()
p = []
w = []
s = []
ssum = 0
wsum = 0
psum = 0
for i in range(n):
	k = float(input())
	if int(k) == k:
		s.append([int(k), i])
		ssum += int(k)
	elif k > 0:
		p.append([int(k), i])
		psum += int(k)
	else:
		w.append([int(k), i])
		wsum += int(k)
q = ssum + wsum + psum
if q > 0:
	for i in range(0, q):
		w[i][0] -= 1
else:
	q = -q
	for i in range(0, q):
		p[i][0] += 1
e = s + p + w
e.sort(key=lambda x: x[1])
for i in range(n):
	print(e[i][0])


import math
n = int(input())
mass = []
for i in range(0, n):
	g = float(input())
	if g % 1 != 0:
		mass.append([math.floor(g), math.ceil(g)])
	else:
		mass.append([int(g)])
s = 0
for i in mass:
	s += i[0]
k = 0
while s != 0:
	if len(mass[k]) > 1:
		(mass[k][0], mass[k][1]) = (mass[k][1], mass[k][0])
		s += 1
	k += 1
for i in mass:
	print(i[0])


input = __import__('sys').stdin.readline
import math
n = int(input())
res = list()
data = list()
for i in range(n):
	data.append(float(input().rstrip()))
for i in data:
	if i < 0:
		res.append(math.floor(i))
	else:
		res.append(math.floor(i))
s = sum(res)
cnt = 0
idx = 0
while cnt != -s:
	if data[idx] != res[idx]:
		res[idx] += 1
		cnt += 1
		idx += 1
	else:
		idx += 1
		continue
for i in res:
	print(i)


n = int(input())
arr = []
brr = []
for i in range(n):
	x = float(input())
	if x < 0 and int(x) != x:
		arr.append(int(x) - 1)
		brr.append(x)
	elif x > 0 and int(x) != x:
		arr.append(int(x) + 1)
		brr.append(x)
	else:
		arr.append(int(x))
		brr.append(x)
s = sum(arr)
if s == 0:
	print(*arr, sep='\n')
elif s > 0:
	i = 0
	while s != 0:
		if arr[i] > 0 and abs(brr[i] - arr[i]) != 0:
			arr[i] -= 1
			s = sum(arr)
		i += 1
	print(*arr, sep='\n')
else:
	i = 0
	while s != 0:
		if arr[i] < 0 and abs(brr[i] - arr[i]) != 0:
			arr[i] += 1
			s = sum(arr)
		i += 1
	print(*arr, sep='\n')


from math import floor, ceil
import sys

def main():
	n = int(sys.stdin.readline())
	isum = 0
	isumcopy = 0
	for i in range(n):
		num = float(sys.stdin.readline())
		if int(num) == num:
			print(int(num))
			continue
		isum += num
		f = ceil(num)
		s = floor(num)
		if abs(isumcopy + f - isum) <= abs(isumcopy + s - isum):
			sys.stdout.write(str(f) + '\n')
			isumcopy += f
		else:
			sys.stdout.write(str(s) + '\n')
			isumcopy += s
main()


import math
import sys
EPS = 10 ** (-6)
n = int(input())
arr = []
new_arr = []
for _ in range(n):
	arr.append(float(input()))
	new_arr.append(math.floor(arr[-1]))
current_sum = sum(new_arr)
i = -1
while current_sum is not 0 and i < n:
	i += 1
	if abs(arr[i] - int(arr[i])) < EPS:
		continue
	new_arr[i] += 1
	current_sum += 1
print('\n'.join(map(str, new_arr)))


a = []
n = int(input())
for _ in range(n):
	a.append(float(input()))
ns = 0
ps = 0
for i in range(n):
	if a[i] < 0:
		ns += int(a[i])
	else:
		ps += int(a[i])
cha = ps + ns
if cha == 0:
	for i in range(n):
		print(int(a[i]))
elif cha < 0:
	i = 0
	while cha != 0 and i < n:
		if a[i] - int(a[i]) != 0 and a[i] > 0:
			a[i] = int(a[i]) + 1
			cha += 1
		i += 1
	for i in range(n):
		print(int(a[i]))
else:
	i = 0
	while cha != 0 and i < n:
		if a[i] - int(a[i]) != 0 and a[i] < 0:
			a[i] = int(a[i]) - 1
			cha -= 1
		i += 1
	for i in range(n):
		print(int(a[i]))


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	n = I()
	a = []
	for i in range(n):
		a.append(float(input()))
	b = []
	s = 0
	for i in range(n):
		b.append(int(a[i]))
		s += b[i]
	i = 0
	for i in range(n):
		if s == 0:
			break
		if s > 0:
			if a[i] >= b[i]:
				continue
			else:
				b[i] -= 1
				s -= 1
		elif a[i] <= b[i]:
			continue
		else:
			b[i] += 1
			s += 1
	for i in b:
		print(i)
for _ in range(1):
	case()


import math
count = int(input())
numbers = []
for x in range(count):
	numbers.append(float(input()))
total = 0
temp = []
for k in numbers:
	x = int(math.floor(k))
	total += x
	temp.append((x, k))
result = []
for (floor, original) in temp:
	if float(floor) == original or total == 0:
		result.append(floor)
	else:
		total += 1
		result.append(floor + 1)
for g in result:
	print(g)


import math
N = int(input())
arr = [0.0] * N
s = 0
for i in range(N):
	n = float(input())
	d = int(n)
	if d <= n:
		s += d
	elif d > n:
		s += d - 1
	arr[i] = n
for i in range(N):
	num = 0
	d = int(arr[i])
	if d == arr[i]:
		C = d
		F = d
	elif d < arr[i]:
		C = d + 1
		F = d
	else:
		C = d
		F = d - 1
	if s < 0 and (not arr[i].is_integer()):
		s += 1
		num = C
	else:
		num = F
	print(num)


n = int(input())
li = [float(input()) for i in range(n)]
pos = 0
neg = 0
for i in li:
	if i == int(i):
		continue
	if i >= 0:
		pos += 1
	else:
		neg += 1
e = sum(list(map(int, li)))
for i in li:
	if i == int(i):
		print(int(i))
		continue
	if i > 0 and e < 0:
		print(int(i) + 1)
		e += 1
	elif i < 0 and e > 0:
		print(int(i) - 1)
		e -= 1
	else:
		print(int(i))


import sys
import math
num = int(input())
data = sys.stdin.readlines()
a = []
av = set()
for i in range(num):
	d = data[i].strip()
	if d[-5:] != '00000':
		a.append(math.floor(float(d)))
		av.add(i)
	else:
		a.append(int(d[:-6]))
sm = -1 * sum(a)
for i in range(sm):
	ind = av.pop()
	a[ind] += 1
[print(q) for q in a]


pos = [0] * (10 ** 5 + 1)
neg = [0] * (10 ** 5 + 1)
positive = []
negitive = []
n = int(input())
for i in range(n):
	a = float(input())
	if a >= 0:
		positive.append([int(a), i])
		if a != int(a):
			pos[len(positive) - 1] = 1
	if a < 0:
		negitive.append([int(a), i])
		if a != int(a):
			neg[len(negitive) - 1] = 1
(a, b) = (0, 0)
for i in range(len(positive)):
	a += positive[i][0]
for i in range(len(negitive)):
	b += negitive[i][0]
it = 0
while a < abs(b):
	if pos[it]:
		positive[it][0] += 1
		a += 1
	it += 1
it = 0
while abs(b) < a:
	if neg[it]:
		negitive[it][0] -= 1
		b -= 1
	it += 1
stock = []
for i in range(len(negitive)):
	stock.append(negitive[i])
for i in range(len(positive)):
	stock.append(positive[i])
stock.sort(key=lambda x: x[1])
for i in range(n):
	print(stock[i][0])


l = []
for i in range(int(input())):
	l.append(float(input()))
temp = list(map(int, l))
cur = sum(temp)
if cur > 0:
	for i in range(len(temp)):
		if l[i] < 0:
			ss = str(l[i])
			lmn = ss.split('.')
			if lmn[1] == '0':
				continue
			temp[i] -= 1
			if sum(temp) == 0:
				print(*temp, sep='\n')
				break
elif cur < 0:
	for i in range(len(temp)):
		if l[i] > 0:
			ss = str(l[i])
			lmn = ss.split('.')
			if lmn[1] == '0':
				continue
			temp[i] += 1
			if sum(temp) == 0:
				print(*temp, sep='\n')
				break
else:
	print(*temp, sep='\n')


from sys import stdin

def solve():
	N = int(stdin.readline())
	A = []
	neg_0 = set()
	pos_0 = set()
	ignore = set()
	for i in range(N):
		x = float(stdin.readline())
		if x == int(x):
			ignore.add(i)
		elif int(x) == 0:
			if x >= 0:
				pos_0.add(i)
			else:
				neg_0.add(i)
		A.append(int(x))
	S = sum(A)
	if S > 0:
		i = 0
		while i < N and S > 0:
			if i in ignore:
				i += 1
				continue
			if A[i] == 0:
				if i in neg_0:
					A[i] -= 1
					S -= 1
				i += 1
				continue
			if A[i] > 0:
				i += 1
				continue
			A[i] -= 1
			i += 1
			S -= 1
	elif S < 0:
		i = 0
		while i < N and S < 0:
			if i in ignore:
				i += 1
				continue
			if A[i] == 0:
				if i in pos_0:
					A[i] += 1
					S += 1
				i += 1
				continue
			if A[i] < 0:
				i += 1
				continue
			A[i] += 1
			i += 1
			S += 1
	print('\n'.join(map(str, A)))
solve()


from math import floor
n = int(input())
a = []
b = []
for i in range(n):
	a.append(float(input()))
	b.append(floor(a[i]))
k = sum(b)
i = 0
while k:
	if a[i] != int(a[i]):
		b[i] += 1
		k += 1
	i += 1
print(*b, sep='\n')


import math
n = int(input())
l = []
y = []
s = 0
for i in range(n):
	z = float(input())
	if int(z) != z:
		y.append(i)
	l.append(math.floor(z))
s = sum(l)
i = 0
while s < 0:
	l[y[i]] += 1
	i += 1
	s += 1
for i in l:
	print(i)


import math
n = int(input())
a = []
for i in range(n):
	i = float(input())
	a.append(i)
upper = []
lower = []
for j in a:
	upper.append(math.ceil(j))
	lower.append(math.floor(j))
sumup = sum(upper)
sumlo = sum(lower)
for i in range(len(a)):
	if sumup > 0:
		if lower[i] < upper[i]:
			print(lower[i])
			sumup -= 1
		else:
			print(upper[i])
	else:
		print(upper[i])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
from fractions import Fraction
from math import floor, ceil
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
n = int(ri())
a = []
for i in range(n):
	a.append(float(ri()))
(psum, nsum, pno, nno) = (0, 0, 0, 0)
for i in a:
	if i < 0:
		if int(i) != i:
			nno += 1
		nsum += floor(i)
	elif i > 0:
		if int(i) != i:
			pno += 1
		psum += ceil(i)
if abs(nsum) < abs(psum):
	cnt = abs(abs(nsum) - abs(psum))
	for i in range(len(a)):
		if a[i] < 0:
			a[i] = floor(a[i])
		elif a[i] > 0:
			if a[i] != floor(a[i]):
				if cnt > 0:
					cnt -= 1
					a[i] = floor(a[i])
				else:
					a[i] = ceil(a[i])
			else:
				a[i] = int(a[i])
		else:
			a[i] = int(a[i])
	for i in a:
		print(i)
else:
	cnt = abs(abs(nsum) - abs(psum))
	for i in range(len(a)):
		if a[i] > 0:
			a[i] = ceil(a[i])
		elif a[i] < 0:
			if a[i] != ceil(a[i]):
				if cnt > 0:
					cnt -= 1
					a[i] = ceil(a[i])
				else:
					a[i] = floor(a[i])
			else:
				a[i] = int(a[i])
		else:
			a[i] = int(a[i])
	for i in a:
		print(i)


import math
n = int(input())
a = []
b = []
for i in range(n):
	a.append(float(input()))
	b.append(math.floor(a[i]))
s = sum(b)
t = 0
if abs(s) <= n:
	for i in range(n):
		if t == abs(s):
			print(*b, sep='\n')
			break
		if math.ceil(a[i]) != math.floor(a[i]):
			b[i] = int(math.floor(b[i])) + 1
			t += 1


import math
N = int(input())
v = []
for i in range(N):
	add = float(input())
	if add == int(add):
		add = int(add)
	v.append(add)
for (i, num) in enumerate(v):
	if type(num) == int:
		continue
	v[i] = float(math.floor(num))
total = sum(v)
for (i, num) in enumerate(v):
	if type(num) == int or total == 0:
		continue
	v[i] = v[i] + 1
	total += 1
for n in v:
	print(int(n))