QOJ.ac

QOJ

时间限制: 1 s 内存限制: 512 MB 总分: 100

#6268. Pointing Rivers and Mountains

统计

Given a sequence $a_1, a_2, \dots, a_n$, you can perform the following operation any number of times:

  • Choose an index $i$ and replace $a_i$ with $-(a_1 + a_2 + \dots + a_n)$.

Find the lexicographically smallest sequence $a$ that can be obtained.

Input

The first line contains a positive integer $n$.

The next line contains $n$ integers, given in non-decreasing order, representing $a_i$.

Output

Output a single line containing $n$ integers, representing the lexicographically smallest sequence.

Examples

Input 1

3
2 -3 2

Output 1

-3 -1 2

Note 1

$[2, -3, 2] \to [2, -1, 2] \to [-3, -1, 2]$

Subtasks

For $100\%$ of the data, $1 \leq n \leq 10^5$ and $|a_i| \leq 10^9$.

For test cases $1 \sim 4$, $n \leq 5$.

For test cases $5 \sim 7$, $n \leq 10^3$.

For test cases $8 \sim 10$, there are no additional constraints.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.