CF1237A.Balanced Rating Changes

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Balanced Rating Changes

Another Codeforces Round has just finished! It has gathered nn participants, and according to the results, the expected rating change of participant ii is aia_i. These rating changes are perfectly balanced — their sum is equal to 00.

Unfortunately, due to minor technical glitches, the round is declared semi-rated. It means that all rating changes must be divided by two.

There are two conditions though:

  • For each participant ii, their modified rating change bib_i must be integer, and as close to ai2\frac{a_i}{2} as possible. It means that either bi=ai2b_i = \lfloor \frac{a_i}{2} \rfloor or bi=ai2b_i = \lceil \frac{a_i}{2} \rceil. In particular, if aia_i is even, bi=ai2b_i = \frac{a_i}{2}. Here x\lfloor x \rfloor denotes rounding down to the largest integer not greater than xx, and x\lceil x \rceil denotes rounding up to the smallest integer not smaller than xx.
  • The modified rating changes must be perfectly balanced — their sum must be equal to 00.

Can you help with that?

Input

The first line contains a single integer nn (2n138452 \le n \le 13\,845), denoting the number of participants.

Each of the next nn lines contains a single integer aia_i (336ai1164-336 \le a_i \le 1164), denoting the rating change of the ii-th participant.

The sum of all aia_i is equal to 00.

Output

Output nn integers bib_i, each denoting the modified rating change of the ii-th participant in order of input.

For any ii, it must be true that either bi=ai2b_i = \lfloor \frac{a_i}{2} \rfloor or bi=ai2b_i = \lceil \frac{a_i}{2} \rceil. The sum of all bib_i must be equal to 00.

If there are multiple solutions, print any. We can show that a solution exists for any valid input.

Note

In the first example, b1=5b_1 = 5, b2=3b_2 = -3 and b3=2b_3 = -2 is another correct solution.

In the second example there are 66 possible solutions, one of them is shown in the example output.

Samples

3
10
-5
-5
5
-2
-3
7
-7
-29
0
3
24
-29
38
-3
-15
0
2
12
-15
19

在线编程 IDE

建议全屏模式获得最佳体验